-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IAVL crashes with "value missing hash" under high load #240
Comments
Hello! Thanks for giving us a heads up on this. We'll take a look ASAP. |
Thanks for the quick reply @tessr That could be a data race in our side. We are investigating it... we'll report more information once available. |
Yeah, I don't believe IAVL is concurrency-safe (although I'm not 100% sure), so if the application is making concurrent accesses - in particular writes - then I believe you'd see problems like this under load. Are you using IAVL concurrently? Do you see the same problems if you put an |
We are using a RWMutex already:
However we suspect that the fact that we do use pointers
Could raise a data race when app.State.AppTree changes. |
Ah - yes, I think that might be a cause. Let us know what you find, and if there's a problem with IAVL itself it would be very helpful with a minimal reproducible case. |
@erikgrinaker just to double check - if one is running write operations on the mutable tree, such as If the above is correct, then it's very probably a data race on our side. We do have a mutex guarding the immutable tree, like @p4u mentioned, but the write operations on the mutable tree aren't guarded by the same mutex. So we might end up calling |
I'm not too familiar with the details here, but that would not surprise me - for example when removing orphan nodes or pruning old versions. To be safe, I would use a mutex for all operations against the entire IAVL store. We should really specify the exact concurrency semantics for IAVL, and maybe down the line implement some form of concurrency control. |
Thanks - sounds good with me. I was going to suggest that the docs be clarified a bit, for now. The immutable tree does say |
For sure, we should clarify what the intended behavior here is. It is sort of unintuitive that an immutable tree is, well, mutable. |
Yes, that's a good point. I think that's what caused confusion for us - the ImmutableTree name seems to imply that it's a completely immutable and static snapshot of a tree, when it's not. It's meant for immutable use, but it itself is not immutable. |
I'll close this for now, but do let us know if you still see problems even with a mutex around all operations. |
So I can confirm that the issue was in our side due a data race. It's also fixed in our side and after running several benchmarks, no Panic found. Thanks for your time and help @erikgrinaker |
When performing a benchmark under high load operation, IAVL panics. We have seen this error on different servers and many times already. Looks like there is something missing on the IAVL tree, but not sure what. After re-launching the program everything goes back to normal and IAVL works fine.
The text was updated successfully, but these errors were encountered: