-
Notifications
You must be signed in to change notification settings - Fork 106
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
Crash in sizeBelowThreshold #675
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
This is my fix, please take a look. |
@wenyue are you willing to open a PR with the fix and a test? Triage note: we will look into this in spare time. |
Fix potential crash in sizeBelowThreshold when modifying children in a directory. Closes #675
I found a bug that can cause a crash. In the directory sizeBelowThreshold function, we call the EnumLinksAsync function, then call parallelShardWalk, and the sizeBelowThreshold function may be end if we have already fetched enough shards to assert we are above the threshold. At this time, parallelShardWalk may still running the nextShard.walkChildren.
Next, because sizeBelowThreshold has been completed, we can continue to modify direcotry. At this time, walkChildren will cause a crash because the hamt ds.childer has been modified.
An example is:
Call direcotry.unlink(), and then immediately call direcotry.addChild(). If run many times, it may trigger a crash.
The text was updated successfully, but these errors were encountered: