-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
function scoped static variable destruct early and cause a crash when used with ASAN #12432
Comments
Could you post your code? |
My guess is that somehow failed to call std::thread::join() for Thread T2 |
My guess is that main thread only try to join other threads in ~PosixEnv() from __run_exit_handlers, at which point the culprit bg compaction thread while still running a task may bump into the destructing unordered_set since during __run_exit_handlers there is absolutedly ZERO guarantee on the destruction order of global variables? |
@ywave620 |
I guess you forget to call Close() for every DB you open before the program exit(either by calling exit() or reaching the end of the main function). If this is the case, just bring Close() back. Here is one possible explanation of your backtrace:
The static variable kBuiltinNameAndAliases destructs before the PosixEnv, which joins all threads. Since you miss a DB::Close() (my assumption), compaction, a background task is running and access the destructed variable. Note that calling DB::Close() will wait for all background task to finish. |
@ywave620 |
Expected behavior
The application linked with rocksdb 8.1.1 is also compiled with -fsanitize=address. During exit() it should stop rocksdb background threads normally.
Actual behavior
In BlockBasedTable::PrefetchIndexAndFilterBlocks() the function scoped static variable kBuiltinNameAndAliases is reportedly already deconstructed by asan while being accessed.
Steps to reproduce the behavior
Main thread return from main function and asan caught above behaviour.
The text was updated successfully, but these errors were encountered: