Skip to content
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] RM_OpenKey not thread-safe #889

Open
keithchew opened this issue Jan 13, 2025 · 0 comments
Open

[CRASH] RM_OpenKey not thread-safe #889

keithchew opened this issue Jan 13, 2025 · 0 comments

Comments

@keithchew
Copy link

keithchew commented Jan 13, 2025

Testing on async_flash branch, but from my analysis, this bug has been around for a long time.

To add some context, I previously reported these dictRehash crashes:
#876
#792

Having more time to review the code, adding extra logging and using gdb, I have finally tracked down the root cause.

The method RM_OpenKey() in module.cpp (called by a module in its own thread) has this call flow:
RM_OpenKey() -> lookupKeyReadWithFlags() -> lookupKeyConst() -> db->find() -> ensure() -> dictAdd() -> dictAddRaw() -> _dictRehashStep() -> dictRehash()

This means there can be multiple threads (one above and the one from keydb) calling the dictRehash() concurrently. Further testing shows that the hashtable in dict.cpp can become corrupted, leading to crashes.

I am experimenting with some new ideas for solving this on my local, and will report here if any of them is successful. Just wanted to report this first, just in case others have also encountered the same crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant