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
[QUESTION] There may be sth wrong in func raxRemove when oom occurs #13180
Comments
there's no memory leak, it's just that when a node is deleted, some nodes might not be cleaned up, i.e. a node doesn't have any children anymore, but it's still there.
Because ts is incomplete, the parent-child relationship is actually unclear, so it can't be compressed. |
Assume that the current tree structure is a->b->c->d->e, and you want to delete the string "abcde."
But if you get an incomplete stack after oom, only a & b in the stack. Although it doesn't affect the use of redis, I think a possible solution is to move the oom judgment to the beginning of raxRemove, like:
|
@wudilun123 If the structure is a->b->c->d->e, then the abc and abcd nodes exist and are not deleted after deleting abcde. |
Thank you for your reply~
Now call raxRemove to delete node abc, assume that we get an incomplete stack without node ab.
|
@wudilun123 you're right, in theory it's possible. |
In func raxRemove, it calls raxLowWalk with a stack to save parents.
But when oom occurs, raxStackPush will not be able to grow in size and save new node, and there is no handling of return value in raxLowWalk:
if (ts) raxStackPush(ts,h); /* Save stack of parent nodes. */
Therefore, when function raxRemove calls raxStackPop after oom, an incomplete stack may be obtained. This will omit processing of some nodes and may cause a memory leak.
What makes me more confused is that there is a judgment about oom in the code later to avoid using an incomplete stack.
The text was updated successfully, but these errors were encountered: