Repository navigation
log: load the test prefix hook atomically and only once - #72166
Merged
Merged
Conversation
Log::_flush() runs on the log thread and did prefix_hook ? prefix_hook() : nullptr on a plain global. PGBackendTestFixture sets the hook in SetUp() and clears it in TearDown() on the gtest thread, so the hook changes while the log thread is flushing. In a Debug build the global is read twice, and if TearDown() clears it between the check and the call, the log thread calls address 0. This is the SIGSEGV in thread "log" with a two-frame backtrace seen in unittest_backend_basics. Make the hook a std::atomic and read it once into a local before testing and calling it. The crash was reproduced by adding a sleep between the check and the call and running the Replicated TestBackendBasics cases, which set up and tear down quickly. It crashes within a few tests, and the same sleep placed after the single load does not crash. Fixes: https://tracker.ceph.com/issues/80565 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
force-pushed
the
wip-80565-log-prefix-hook-race
branch
from
September 29, 2026 10:45
4f2d630 to
1b1c682
Compare
rzarzynski
approved these changes
Oct 1, 2026
bill-scales
approved these changes
Oct 5, 2026
Contributor
|
This PR has been added to wip-bharath10-testing-20261012.232418-main. |
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.
Log::_flush()runs on the log thread and didprefix_hook ? prefix_hook() : nullptron a plain global.PGBackendTestFixturesets the hook inSetUp()and clears it inTearDown()on the gtest thread. In a Debug build the global is read twice, and ifTearDown()clears it between the check and the call, the log thread calls address 0. That is the SIGSEGV in threadlogwith a two-frame backtrace seen inunittest_backend_basics.This makes the hook a
std::atomicand reads it once into a local before testing and calling it.Reproducer (not included): add a
usleep(2000)between the check and the call, then rununittest_backend_basics --gtest_filter='BackendSizes/TestBackendBasics.*/Replicated_*'. It crashes within a few tests with the same signature as CI. With this fix and the same sleep after the single load, 3 repeats run without a crash. The fullunittest_backend_basicspasses (888 tests).While this is only used by a single test harness, out of paranoia I am running it through a QA batch, as its not that urgent.
Fixes: https://tracker.ceph.com/issues/80565
Checklist
🤖 Generated with Claude Code