-
Notifications
You must be signed in to change notification settings - Fork 990
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
fix(rax_tree): Fix crash caused by destructor in RaxTreeMap #4228
fix(rax_tree): Fix crash caused by destructor in RaxTreeMap #4228
Conversation
Can you please explain what the problem is in the PR description? |
104c9cf
to
103d333
Compare
Done |
@BagritsevichStepan I agree that the interface of |
fixes dragonflydb#4172 Signed-off-by: Stepan Bagritsevich <[email protected]>
cccc397
to
b6de484
Compare
Signed-off-by: Stepan Bagritsevich <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
have you run on the traces you have to see it's working well? |
Yes, https://github.com/dragonflydb/dragonfly/actions/runs/12162671806 |
* fix(rax_tree): Fix double raxStop call in the SeekIterator fixes #4172 Signed-off-by: Stepan Bagritsevich <[email protected]> * refactor(rax_tree): Address comments Signed-off-by: Stepan Bagritsevich <[email protected]> --------- Signed-off-by: Stepan Bagritsevich <[email protected]>
fixes #4172
The cause of the crash is double
raxStop
call: first time in theoperator++
whenraxNext
returns false, second time in the destructor of theSeekIterator
.In this PR:
raxStop
callraxSeek
returns 0 in the constructoroperator=
for theSeekIterator
operator==
for theFindIterator
. We had some strange logic there:if (this->has_value() != !bool(rhs.it_.flags & RAX_ITER_EOF))
I also propose to change destructor of the
RaxTreeMap
. It should invokeraxFreeWithCallback
. The problem is that this will require a capturing lambda, as we need to passalloc_
. Therefore, we need to copy and update theraxFreeWithCallback
method for capturing lambdas.