Bug #79951
closedCeph MDS outage caused by a crash in the batch-op cleanup path
0%
Description
We hit another Ceph MDS outage caused by a crash in the batch-op cleanup path.
The issue begins with a large number of slow requests stuck in the MDS while waiting to acquire write locks. The queue eventually reaches a severe backlog, and the affected client is evicted. During eviction, the MDS crashes with an assertion in the batch-op map logic.
Relevant log snippets:
Aug 24 00:15:32 ceph-mds: log_channel(cluster) log [WRN] : 3 slow requests, 3 included below; oldest blocked for > 30 secs
Aug 24 00:15:32 ceph-mds: log_channel(cluster) log [WRN] : slow request 30s old: client_request(... lookup ...) currently failed to wrlock, waiting
Aug 24 00:15:32 ceph-mds: log_channel(cluster) log [WRN] : slow request 30s old: client_request(... rename ...) currently failed to wrlock, waiting
Aug 24 00:15:32 ceph-mds: log_channel(cluster) log [WRN] : slow request 30s old: client_request(... create ...) currently failed to wrlock, waiting
Peak backlog:
Aug 24 01:47:07 ceph-mds: log_channel(cluster) log [WRN] : 60 slow requests, 5 included below; oldest blocked for > 5500 secs
Aug 24 01:47:07 ceph-mds: log_channel(cluster) log [WRN] : slow request ... currently joining batch lookup
Aug 24 01:47:07 ceph-mds: log_channel(cluster) log [WRN] : slow request ... currently joining batch getattr
After client eviction is attempted:
Aug 24 01:47:09 ceph-mds: log_channel(cluster) log [INF] : Evicting client session ...
ceph-mds: .../bits/stl_tree.h: ...: std::_Rb_tree<...>::erase(...) Assertion '__position != end()' failed.
ceph-mds: * Caught signal (Segmentation fault) *
in thread ... thread_name:admin_socket
This is a crash due to an assertion failure in Ceph MDS code. The underlying issue is a map of batch operations:
std::map<int, std::unique_ptr<BatchOp>> batch_ops;
A pointer to this map is stored in MDRequestImpl::batch_op_map. The erase() call is invoked with an iterator that can be end(), which is invalid. There are multiple erase paths that do not check whether the item exists before moving or erasing it.
Example:
std::unique_ptr<BatchOp> MDRequestImpl::release_batch_op()
{
int mask = client_request->head.args.getattr.mask;
auto it = batch_op_map->find(mask);
std::unique_ptr<BatchOp> bop = std::move(it->second);
batch_op_map->erase(it);
return bop;
}
This assumes the item exists, but there is no check for not-found conditions. This makes the code fragile under concurrent state changes and is consistent with the observed crash path.
We believe this is the same class of bug as a previously observed MDS crash and that the fix should guard against missing entries and invalid iterators before erase or access.
Affected versions appear to include Ceph 18.2.x and current master / upstream code.
There's already a PR open for that. Please check it
https://github.com/ceph/ceph/pull/71274
PD Updated by Patrick Donnelly 3 months ago
- Project changed from Ceph to CephFS
- Assignee set to Max Kellermann
- Target version set to v22.0.0
- Source set to Community (user)
- Backport set to umbrella,tentacle,squid
- Labels (FS) crash added
VS Updated by Venky Shankar 3 months ago
- Category set to Correctness/Safety
- Component(FS) MDS added
UB Updated by Upkeep Bot 3 months ago
- Status changed from Fix Under Review to Pending Backport
- Merge Commit set to 165146c0417c8ffeef7eeb6abb798a17b980dc7f
- Fixed In set to v21.3.0-3027-g165146c041
- Upkeep Timestamp set to 2026-09-08T05:40:38+00:00
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80372: umbrella: Ceph MDS outage caused by a crash in the batch-op cleanup path added
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80373: squid: Ceph MDS outage caused by a crash in the batch-op cleanup path added
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80374: tentacle: Ceph MDS outage caused by a crash in the batch-op cleanup path added
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Backporting
- Upkeep Timestamp changed from 2026-09-08T05:40:38+00:00 to 2026-09-08T12:28:29+00:00