Bug #80565
closedunittest_backend_basics (SEGFAULT)
0%
Description
01:48:27 [ SKIPPED ] BackendSizes/TestBackendBasics.TruncateGrowWithSuspendedReads/Replicated_8k (11 ms) 01:48:27 [ RUN ] BackendSizes/TestBackendBasics.TruncateGrowWithSuspendedReads/Replicated_12k 01:48:27 *** Caught signal (Segmentation fault) ** 01:48:27 in thread 71f61b9a6640 thread_name:log 01:48:27 ceph version Development (no_version) umbrella (dev - Debug) 01:48:27 1: /ceph/build/bin/unittest_backend_basics(+0x1bfc624) [0x57da4bdf7624] 01:48:27 2: /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x71f61c5ad520] 01:48:27
from 'make check' https://jenkins.ceph.com/job/ceph-pr-pipeline/1480/consoleFull#92422989177933967-90d1-4877-8d60-89cb08ef4eb1
AA Updated by Alex Ainscow 3 months ago
Thankyou for the update.
The crash is in the log thread at offset +0x1bfc624, with only 2 stack frames — a pattern consistent with heap corruption, where the allocator's metadata has been clobbered by a previous operation, and the crash manifests later when the log thread next touches heap memory (e.g. m_log_buf.resize(), a string allocation in _flush, or the m_recent ring buffer push).
The most likely corruption site is the k8m3 DirectRead test that ran just before — it's the largest fixture (11 shards, 8 data + 3 coding), doing EC reads, and is the last non-skipped test before the crash. When it tears down, it destroys 11 ECBackend instances, 11 MockPGBackendListener instances, 11 ECExtentCache::LRU instances, and an OSDMap. Any use-after-free or out-of-bounds write in those destructors would corrupt the heap, causing the log thread to crash when it next allocates.
The fact that it doesn't reproduce locally is consistent with heap corruption — it's sensitive to memory layout, timing of allocator reuse, and the exact sequence of allocations/frees, all of which differ between the heavily-loaded Jenkins machine running 960 tests back-to-back and your local machine.
The thread_name:log crash is a symptom, not the cause. The actual bug is heap corruption somewhere earlier — most likely in the ECBackend, ECExtentCache, or their destructors.
When I have some time, I will recompile with the address sanitizer and see if I can detect any heap corruption at an earlier point. If this starts being a regular problem on many PRs, tell me and I will up the priority of this task.
LF Updated by Laura Flores 2 months ago
- Status changed from New to In Progress
AA Updated by Alex Ainscow 2 months ago
- Pull request ID set to 72166
AA Updated by Alex Ainscow 2 months ago
Turns out my earlier guess was wrong: this isn't heap corruption.
The log thread uses a prefix hook that I added for the EC test harness, to tag log lines with the OSD. The harness sets it in SetUp() and clears it in TearDown(). The log thread does prefix_hook ? prefix_hook() : nullptr, and in a debug build that reads the pointer twice. If a test tears down between the two reads, the log thread jumps to the null address. That explains the crash being in the log thread, the two-frame stack, and it happening in a run of skipped tests, which set up and tear down very quickly.
It's a tiny window, so it almost never happens on its own. I can make it crash every time by adding a sleep between the check and the call.
The fix makes the hook atomic and reads it once. Only the test harness sets the hook, so normal logging isn't affected. PR to linked.
LF Updated by Laura Flores 2 months ago
- Status changed from In Progress to Fix Under Review
KS Updated by Kamoltat (Junior) Sirivadhna about 2 months ago
PR getting tested
RZ Updated by Radoslaw Zarzynski about 2 months ago
- Status changed from Fix Under Review to Resolved
UB Updated by Upkeep Bot about 2 months ago
- Merge Commit set to a4692027bb0822932d7ca9c428d6e82a21021643
- Fixed In set to v21.3.0-4483-ga4692027bb
- Upkeep Timestamp set to 2026-10-15T19:41:20+00:00
KS Updated by Kamoltat (Junior) Sirivadhna about 2 months ago
RADOS APPROVED and MERGED! moving to RESOLVED since we don't want to backport