Repository navigation
Call OpenSSL cleanup before safeExit to fix LeakSanitizer false positives - #98296
Merged
Merged
Conversation
…izer false positives When the server takes the forced shutdown path via `safeExit` → `_exit`, static destructors and atexit handlers are bypassed, so `OpenSSLInitializer::cleanup` / `OPENSSL_cleanup` never runs. ASan intercepts `_exit` and runs LSan, which reports OpenSSL's global cached state (EVP method cache, legacy provider context) as leaked memory. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97652&sha=c9d73d1a85abfa220c6ddad38d81e7acb72be2e9&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [4cfb8644] Summary: ❌
|
Member
|
Sanitizer report mentions |
The same `safeExit` pattern exists in `programs/keeper/Keeper.cpp`. Apply the same `OpenSSLInitializer::cleanup` call to avoid LeakSanitizer false positives in Keeper as well. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
Author
|
Done. |
Member
Author
alexey-milovidov
added a commit
that referenced
this pull request
Feb 28, 2026
…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]>
alexey-milovidov
added a commit
that referenced
this pull request
Mar 1, 2026
…tive Call OpenSSL cleanup before safeExit to fix LeakSanitizer false positives
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
OpenSSLInitializer::cleanupbeforesafeExitin the forced server shutdown pathsafeExit→_exit, static destructors are bypassed, soOPENSSL_cleanupnever runs_exitand runs LSan, which reports OpenSSL global cached state as leaked memoryCI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97652&sha=c9d73d1a85abfa220c6ddad38d81e7acb72be2e9&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan%29
#97652
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix LeakSanitizer false positives for OpenSSL on forced server shutdown.
🤖 Generated with Claude Code
Version info
26.3.1.156