[rtsan] Refactor initialization state to prevent hangs #109830
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move to tri state (Uninitialized, Initialized, Initializing) for our init state. We currently just have 2 (Uninitialized and Initialized).
Why?
Later, when introducing exit statistics, I add an
Atexit
handler. This handler is called, as the name suggests, at exit time. OurAtexit
handler will print the exit stats if the user has requested.We will install this Atexit handler when we are initializing for the first time. However during this process, intercepted functions are called - causing a hang.
We now early exit out of
__rtsan_notify_intercepted_call
if we are initializingI do not think we need the same check in
__rtsan_notify_blocking_call
because no calls marked blocking will be made during init, these are mostly low level bootstrap calls.