Bug #76563
closedRGW: log trim infinite loop is causing CPU hogging while there's no data_log entries to trim
0%
Description
Issue Description:¶
Related conversation: https://ceph-storage.slack.com/archives/C1HFU4JK1/p1776029060801259
I've upgraded 2 clusters of mine from squid to tentacle, one managed by rook and one managed by cephadm. both are pretty small (3 bare-metal nodes, one with ~70 TiB raw and the other with ~30 TiB with plenty of CPU and memory headroom. both use ssds only, rook on nvme and the cephadm cluster on sata and sas ssds). the rook cluster upgrade was smooth sailing, I haven't noticed a difference before and after except for the new dashboard. on the cephadm cluster I later noticed that host CPU usage went up from 1-2% (as I said, lots of CPU headroom) to 60% right after the upgrade combined with a similar increase in IOPS (stable 150k) and network load. this load has been stable for the last 5 hours. ceph status reports HEALTH_OK, no recovery and only the occasional deep scrubbing pg. (the attached image is the CPU graph from the ceph dashboard. arrows show reboots of the nodes before the ceph upgrade) one of the osd's logs show this a lot: rocksdb: [db/db_impl/db_impl_write.cc:2098] [P] New memtable created with log file: #321328. Immutable memtables: 19. rocksdb: (Original Log Time 2026/04/12-21:12:56.056645) [db/db_impl/db_impl_compaction_flush.cc:3275] Compaction nothing to donot sure if that happend before as well. htop shows only about 10 to 120 mb/s disk throughput (r+w) across the osds. interestingly: I have 14 osds per node, with 10 sata ssds in the device class "ssd" and the remaining 4 in a device class "sas-ssd". The osds showing high load seem to be those 10 in the "ssd" class. However, the "sas-ssd" osds currently carry barely any data (< 1% utilization). The utilization of the "ssd" osds is at around 70%.

You can also find the flamegraph in the attachment: perf.svg.
Potential Root Cause¶
The use_awaitable_t overloads of trim() in src/neorados/cls/log.h have an issue where the ENODATA error handling is inside the for(;;) retry loop instead of outside it. When cls_log_trim returns ENODATA (nothing left to trim), the error is caught and silently swallowed, causing the loop to retry forever — submitting RADOS ops at maximum rate.
This affects any RGW with a realm/period configured and existing data_log objects. This issue should be more severe on clusters where data log shards are persistently empty (e.g. single-site clusters that previously had multisite configured, or multisite clusters with low write activity) — all 128 trim coroutines enter the infinite loop simultaneously, causing sustained high CPU usgae and high IOPS from zero useful work.
Why high IOPS? I believe because each iteration of the infinite loop submits a real RADOS WriteOp (the cls_log_trim cls method call) to the OSDs.
The RGWSyncLogTrimThread fires after rgw_sync_log_trim_interval (default 20 min), spawns 128 trim coroutines (one per data log shard), and any shard that is empty enters the infinite loop.
Workaround: set rgw_sync_log_trim_interval=0.¶
Is this regression¶
I'd say yes....trim() use_awaitable_t overloads in src/neorados/cls/log.h were added by neorados/cls: Client for log objclass which is a new code in the Tentacle release. I mean Squid shouldn't have this issue.
I'll open a draf PR as well showing we can reproduce this issue via a unittest.
We can discuss more on this issue here and the PR I think.
Files
OO Updated by Oguzhan Ozmen 7 months ago
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 68874
UB Updated by Upkeep Bot 6 months ago
- Status changed from Fix Under Review to Pending Backport
- Merge Commit set to e33ecece82ee6e7822fa77deeef68a08b30fd121
- Fixed In set to v21.0.0-1755-ge33ecece82
- Upkeep Timestamp set to 2026-05-26T18:50:51+00:00
UB Updated by Upkeep Bot 6 months ago
- Copied to Backport #76818: tentacle: RGW: log trim infinite loop is causing CPU hogging while there's no data_log entries to trim added
UB Updated by Upkeep Bot 6 months ago
- Tags (freeform) set to backport_processed
UB Updated by Upkeep Bot 5 months ago
- Status changed from Pending Backport to Resolved
- Upkeep Timestamp changed from 2026-05-26T18:50:51+00:00 to 2026-07-10T13:29:31+00:00
UB Updated by Upkeep Bot 3 months ago
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2026-07-10T13:29:31+00:00 to 2026-08-28T01:42:01+00:00
UB Updated by Upkeep Bot about 1 month ago
- Released In set to v21.2.0~366
- Upkeep Timestamp changed from 2026-08-28T01:42:01+00:00 to 2026-10-24T02:03:34+00:00