Repository navigation
Call __lsan_do_leak_check before _exit in safeExit to fix LSan false positives - #98355
Merged
Merged
Conversation
…anitizer false positives `safeExit` calls `_exit`, which bypasses static destructors and atexit handlers. ASan intercepts `_exit` and runs LSan, which then reports memory from libraries (e.g., OpenSSL global state) as leaked because their cleanup routines never ran. By calling `__lsan_do_leak_check` before `_exit`, the leak check runs while all memory is still reachable through global pointers, and the subsequent at-exit check is disabled. This prevents false positives without requiring per-library cleanup calls. Supersedes #98296 (reverted in #98354). #98354 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
This was referenced Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
__lsan_do_leak_checkinsafeExitbefore_exitwhenADDRESS_SANITIZERis definedOPENSSL_cleanup) which are skipped by_exitOpenSSLInitializer::cleanupcalls from Server.cpp and Keeper.cpp added in Call OpenSSL cleanup before safeExit to fix LeakSanitizer false positives #98296, since this approach handles the problem genericallySupersedes #98296 (reverted in #98354).
#98354
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix LeakSanitizer false positives on forced server shutdown by calling
__lsan_do_leak_checkbefore_exit.🤖 Generated with Claude Code