Bug #77947
closedCeph MGR crashing frequently - ** Caught signal (Segmentation fault) ** "in thread 7f3c302ac640 thread_name:mgr-fin"
0%
Description
#0 0x00007f701bbc421c in _pthread_kill_implementation () from /lib64/libc.so.6 #1 0x00007f701bb76bb6 in raise () from /lib64/libc.so.6 #2 0x0000563fc2d55482 in reraise_fatal (signum=11) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/global/signal_handler.cc:88 #3 handle_oneshot_fatal_signal (signum=11) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/global/signal_handler.cc:367 #4 <signal handler called> #5 xlist<LRUObject*>::front (this=0x563fea8a7648) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/include/xlist.h:147 #6 LRU::adjust (this=0x563fea8a7620) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/include/lru.h:195 #7 0x00007f70123d08a5 in LRU::lru_remove (o=0x564018b04540, this=0x563fea8a7620) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/include/lru.h:101 #8 Client::unlink (this=0x563fea8a7400, dn=0x564018b04540, keepdir=<optimized out>, keepdentry=<optimized out>) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:3761 #9 0x00007f70123afad8 in Client::trim_cache (this=0x563fea8a7400, trim_kernel_dcache=<optimized out>) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:875 #10 0x00007f7012451219 in Client::tick (this=0x563fea8a7400) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:7350 #11 operator() (_closure=<optimized out>) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:7380 #12 std::__invoke_impl<void, Client::start_tick_thread()::<lambda()> > (_f=...) at /usr/include/c++/11/bits/invoke.h:61 #13 std::_invoke<Client::start_tick_thread()::<lambda()> > (__fn=...) at /usr/include/c++/11/bits/invoke.h:96 #14 std::thread::_Invoker<std::tuple<Client::start_tick_thread()::<lambda()> > >::_M_invoke<0> (this=<optimized out>) at /usr/include/c++/11/bits/std_thread.h:259 #15 std::thread::_Invoker<std::tuple<Client::start_tick_thread()::<lambda()> > >::operator() (this=<optimized out>) at /usr/include/c++/11/bits/std_thread.h:266 #16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<Client::start_tick_thread()::<lambda()> > > >::_M_run(void) (this=0x563ff2fe1040) at /usr/include/c++/11/bits/std_thread.h:211 #17 0x00007f701be39ae4 in execute_native_thread_routine () from /lib64/libstdc++.so.6 #18 0x00007f701bbc23f9 in start_thread () from /lib64/libc.so.6 #19 0x00007f701bc475d0 in clone3 () from /lib64/libc.so.6
IG Updated by Igor Golikov 5 months ago
#0 0x00007f701bbc421c in _pthread_kill_implementation () from /lib64/libc.so.6
#1 0x00007f701bb76bb6 in raise () from /lib64/libc.so.6
#2 0x0000563fc2d55482 in reraise_fatal (signum=11) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/global/signal_handler.cc:88
#3 handle_oneshot_fatal_signal (signum=11) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/global/signal_handler.cc:367
#4 <signal handler called>
#5 xlist<LRUObject*>::front (this=0x563fea8a7648) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/include/xlist.h:147
#6 LRU::adjust (this=0x563fea8a7620) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/include/lru.h:195
#7 0x00007f70123d08a5 in LRU::lru_remove (o=0x564018b04540, this=0x563fea8a7620) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/include/lru.h:101
#8 Client::unlink (this=0x563fea8a7400, dn=0x564018b04540, keepdir=<optimized out>, keepdentry=<optimized out>)
at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:3761
#9 0x00007f70123afad8 in Client::trim_cache (this=0x563fea8a7400, trim_kernel_dcache=<optimized out>)
at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:875
#10 0x00007f7012451219 in Client::tick (this=0x563fea8a7400) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:7350
#11 operator() (_closure=<optimized out>) at /usr/src/debug/ceph-19.2.1-374.el9cp.x86_64/src/client/Client.cc:7380
#12 std::__invoke_impl<void, Client::start_tick_thread()::<lambda()> > (_f=...) at /usr/include/c++/11/bits/invoke.h:61
#13 std::_invoke<Client::start_tick_thread()::<lambda()> > (__fn=...) at /usr/include/c++/11/bits/invoke.h:96
#14 std::thread::_Invoker<std::tuple<Client::start_tick_thread()::<lambda()> > >::_M_invoke<0> (this=<optimized out>) at /usr/include/c++/11/bits/std_thread.h:259
#15 std::thread::_Invoker<std::tuple<Client::start_tick_thread()::<lambda()> > >::operator() (this=<optimized out>) at /usr/include/c++/11/bits/std_thread.h:266
#16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<Client::start_tick_thread()::<lambda()> > > >::_M_run(void) (this=0x563ff2fe1040)
at /usr/include/c++/11/bits/std_thread.h:211
#17 0x00007f701be39ae4 in execute_native_thread_routine () from /lib64/libstdc++.so.6
#18 0x00007f701bbc23f9 in start_thread () from /lib64/libc.so.6
#19 0x00007f701bc475d0 in clone3 () from /lib64/libc.so.6
IG Updated by Igor Golikov 5 months ago
The crash signature is the same: SIGSEGV in xlist::front → LRU::adjust → lru_remove → Client::unlink → trim_cache.
But the trigger path is different. The previous crash happened during unmount/shutdown, while this one happens from the tick thread, when it runs the periodic trim_cache() during normal operation.
Both crashes still look like LRU list corruption related to dentry lifetime, but I’m not sure it is exactly the same root cause.
The assert we added also shows that the dentry currently being processed is alive (ref > 1). So it looks like the corruption is already in the LRU list itself. My guess is that some other dentry was freed earlier and left a dangling pointer in the list, probably from a previous trim iteration.
IG Updated by Igor Golikov 5 months ago
Additional investigation of the core dump:
I examined the LRU state at the time of the crash.
The crash occurs in LRU::adjust() when it attempts to access the front of an empty list.
(gdb) p ((LRU*)0x563fea8a7620)->num_pinned
$12 = 2
(gdb) p ((LRU*)0x563fea8a7620)->top._size
$5 = 0
(gdb) p ((LRU*)0x563fea8a7620)->bottom._size
$6 = 0
(gdb) p ((LRU*)0x563fea8a7620)->pintail._size
$7 = 1
Total LRU size = 1, but num_pinned = 2 (impossible — more pinned than exist)
(gdb) p ((xlist<LRUObject*>*)0x563fea8a7648)->_front
$1 = (xlist<LRUObject*>::item *) 0x0 ← NULL deref causes the SIGSEGV
(gdb) p (Dentry)0x564018b04540 ← the dentry being removed
ref = 2, lru = 0x0, lru_pinned = true, dir = 0x0, inode = 0x0
(valid, alive, already removed from LRU by the time we inspect)
The dentry being processed is valid (ref=2, DentryRef guard is working)
The assert we added did not fire — the dentry is not prematurely freed
The LRU internal state is inconsistent: num_pinned = 2 but only 1 item remains in the LRU
This mismatch causes an unsigned integer underflow in the rebalance calculation, which makes the code try to move items from an empty list
It looks like a drift in the num_pinned counter — over repeated cache trim cycles, the counter gets out of sync with the actual number of pinned items. Once num_pinned exceeds the total LRU size, the next trim_cache() call crashes.
VS Updated by Venky Shankar 5 months ago
- Related to Bug #74625: client: segfault on ceph_shutdown() on removing Dentry from LRU added
VS Updated by Venky Shankar 5 months ago
- Description updated (diff)
IG Updated by Igor Golikov 5 months ago
- Status changed from New to Fix Under Review
- Pull request ID set to 69970
VS Updated by Venky Shankar 5 months ago
- Category set to Correctness/Safety
- Source set to Development
- Backport set to umbrella,tentacle,squid
UB Updated by Upkeep Bot 4 months ago
- Status changed from Fix Under Review to Pending Backport
- Merge Commit set to 51542bb89a3780a39b0f14fffd33379c409a4140
- Fixed In set to v21.3.0-2443-g51542bb89a
- Upkeep Timestamp set to 2026-08-20T13:27:16+00:00
UB Updated by Upkeep Bot 4 months ago
- Copied to Backport #79668: tentacle: Ceph MGR crashing frequently - ** Caught signal (Segmentation fault) ** "in thread 7f3c302ac640 thread_name:mgr-fin" added
UB Updated by Upkeep Bot 4 months ago
- Copied to Backport #79669: squid: Ceph MGR crashing frequently - ** Caught signal (Segmentation fault) ** "in thread 7f3c302ac640 thread_name:mgr-fin" added
UB Updated by Upkeep Bot 4 months ago
- Copied to Backport #79670: umbrella: Ceph MGR crashing frequently - ** Caught signal (Segmentation fault) ** "in thread 7f3c302ac640 thread_name:mgr-fin" added
UB Updated by Upkeep Bot 4 months ago
- Tags (freeform) set to backport_processed
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Backporting
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2026-08-20T13:27:16+00:00 to 2026-08-27T18:46:23+00:00
VS Updated by Venky Shankar 16 days ago
- Related to Bug #83221: client: fcopyfile() releases dentry ref without acquiring client_lock added