Bug #81511
closedmon/LogMonitor: since v19.2.3, MLogAck for MLog forwarded by a peon is dropped; client log queues grow forever and are resent in full on every mon reconnect
0%
Description
Summary¶
Since v19.2.3, a daemon whose mon session is on a peon never receives an MLogAck for its cluster log entries. Its LogClient queue is never trimmed: it grows for as long as the daemon runs, and the whole queue is resent each time the mon session is reset. The leader commits the resent entries again, to the cluster log file and to the mon store.
On one of our clusters the active mgr had queued about 13.6 million entries (8.6 GiB RSS). After a network outage of about 30 s it resent them. Within 10 minutes each monitor had written 2.4 GB to ceph.log and grown its store from about 120 MB to about 5 GB. The root filesystems filled up, two of the four monitors stopped, quorum was lost and CephFS stayed frozen for about 7 hours.
Cause¶
The squid backport of the #54489 fix (PR 62213, backport #70380, from PR 61933) removed the return false; that kept LogMonitor::preprocess_log() from reaching mon.no_reply(op) when the MLog carries new entries.
v19.2.2:
if (!num_new) {
dout(10) << " nothing new" << dendl;
goto done;
}
return false;
done:
mon.no_reply(op);
return true;
}
v19.2.3 to v19.2.6, v20.2.0 to v20.2.4, v21.1.1, v18.2.8, and the main, umbrella, tentacle, squid and reef branches:
if (!num_new) {
dout(10) << " nothing new" << dendl;
goto done;
}
done:
mon.no_reply(op);
return (!num_new);
}
For an MLog forwarded by a peon, this is now the sequence:
- On the leader,
preprocess_log()callsno_reply(). The session has aproxy_con, soMonitor::no_reply()sendsMRoute(proxy_tid, NULL)to the peon. - On the peon,
Monitor::handle_route()takes the null route as the answer and erases the routed request. - On the leader,
preprocess_log()returned false, so the MLog goes on toprepare_log()and is committed._updated_log()then sends theMLogAckthroughsend_reply(), asMRoute(proxy_tid, MLogAck). - On the peon,
handle_route()no longer has the routed request ("don't have routed request tid") and drops the ack.
Daemons whose session is on the leader are not affected: there, no_reply() only marks the op.
On the client side, MonClient calls send_log(true) on every new mon session, and LogClient::get_mon_log_message(true) restarts from the front of the queue. When the new session is on the leader, each MLogAck triggers the next batch, so the resend runs as fast as the leader commits. The resent entries are too old to still be in the leader's LogSummary, so they are committed as new.
The peons' own cluster log entries take the same path, since they are forwarded to the leader too (entry 469232 of mon.b below).
Evidence¶
Times are +0200. Host names and addresses are masked. Cluster with 4 monitors: leader mon.a (rank 0), peons mon.b (rank 1), mon.c (rank 2), mon.d (rank 3). Active mgr mgr.77621730 on the host of mon.b, with its session on the peon mon.b. debug_mon 10 on the four monitors for 20 s.
Peon mon.b: mgr entry 27169 is forwarded as tid 1957274. The null route comes back 2 ms later, the real ack 0.9 s later:
2026-10-07T08:59:02.132+0200 7944baffe6c0 10 mon.b@1(peon).log v23657679 preprocess_log log(1 entries from seq 27169 at 2026-10-07T08:59:01.406901+0200) from mgr.77621730 2026-10-07T08:59:02.132+0200 7944baffe6c0 10 mon.b@1(peon) e4 forward_request 1957274 request log(1 entries from seq 27169 at 2026-10-07T08:59:01.406901+0200) features 4540701547738038271 2026-10-07T08:59:02.134+0200 7944baffe6c0 10 mon.b@1(peon) e4 handle_route tid 1957274 null 2026-10-07T08:59:03.055+0200 7944baffe6c0 10 mon.b@1(peon) e4 handle_route tid 1957274 log(last 27169)
Leader mon.a, same entry:
2026-10-07T08:59:02.134+0200 7db6b49556c0 10 mon.a@0(leader).log v23657679 preprocess_log log(1 entries from seq 27169 at 2026-10-07T08:59:01.406901+0200) from mgr.77621730 2026-10-07T08:59:02.134+0200 7db6b49556c0 10 mon.a@0(leader).log v23657679 prepare_log log(1 entries from seq 27169 at 2026-10-07T08:59:01.406901+0200) from mgr.77621730 2026-10-07T08:59:03.052+0200 7db6b21506c0 7 mon.a@0(leader).log v23657679 _updated_log for mgr.77621730 <masked>:0/232321832
The peon's own entry 469232 goes the same way (tid 1957273):
2026-10-07T08:59:02.100+0200 7944baffe6c0 10 mon.b@1(peon) e4 forward_request 1957273 request log(1 entries from seq 469232 at 2026-10-07T08:59:02.099306+0200) features 4540701547738038271 2026-10-07T08:59:02.103+0200 7944baffe6c0 10 mon.b@1(peon) e4 handle_route tid 1957273 null 2026-10-07T08:59:03.055+0200 7944baffe6c0 10 mon.b@1(peon) e4 handle_route tid 1957273 log(last 469232)
The other two peons show the same pattern for their own entries: handle_route tid N null, then handle_route tid N log(last ...) for the same tid.
Client side, debug_monc 10 on the active mgr through its admin socket, 20 s each time:
- Active mgr with its session on the peon
mon.b. The queue size equalslast_log: no entry has been acknowledged since the process started. Nohandle_log_ackin 20 s.
2026-10-07T08:48:39.984+0200 7f41401f26c0 10 log_client log_queue is 26858 last_log 26858 sent 26857 num 26858 unsent 1 sending 1
- After
ceph mgr fail, the new active mgr has its session on the leadermon.a. 10handle_log_ackin 20 s, and the queue stays at 1 entry.
2026-10-07T09:20:37.381+0200 7c73639f26c0 10 log_client log_queue is 1 last_log 39 sent 38 num 1 unsent 1 sending 1 2026-10-07T09:20:38.242+0200 7c73659f66c0 10 log_client handle_log_ack log(last 39)
- At the same time, on our other cluster, the active mgr has its session on a peon: the queue goes from 41 to 43 entries, with no ack.
What happened to us¶
Two clusters, each with 4 monitors on small (20 GB) root filesystems.
- On one cluster, the active mgr had been running for almost a year with its session on a peon, and had never received an ack. Its queue held every entry it had produced, mostly
pgmapDBG entries every 2 s: about 13.6 million entries, 8.6 GiB RSS. - A network outage of about 30 s made both clusters hold elections, and all mon sessions were reset.
- The mgr reconnected to the leader and resent its queue. Entries 2 to 11983001 reached the cluster log, covering about nine months. In 10 minutes each monitor wrote 12.3 million lines (2.4 GB) to
ceph.log, and the mon stores grew from about 120 MB to about 5 GB. - About 10 minutes after the outage, a first monitor stopped ("monitor data filesystem reached concerning levels of available storage space"), then a second one. With 2 monitors out of 4, quorum was lost and CephFS froze until we freed space and restarted the monitors.
- Afterwards the same mgr showed
log_queue is 1684960 last_log 13667961. That is exactly the entries after 11983001, the last one acknowledged while its session was on the leader.
Our other cluster shows the same thing on a smaller scale. When a monitor host was stopped, an OSD resent the 2177 entries it had produced since it started three weeks earlier. When another monitor host rebooted, all OSDs together resent 23136 entries.
Expected behaviour¶
As in v19.2.2: the MLogAck for a forwarded MLog with new entries reaches the client, and the client trims its queue.
Suggested fix¶
Put back the return false; before done:, so that no_reply() is only used for MLogs that get no answer: no session, missing caps, nothing new. A forwarded MLog with new entries is then answered by _updated_log(), and that answer also releases the routed request on the peon.
--- a/src/mon/LogMonitor.cc
+++ b/src/mon/LogMonitor.cc
@@ bool LogMonitor::preprocess_log(MonOpRequestRef op)
if (!num_new) {
dout(10) << " nothing new" << dendl;
goto done;
}
- done:
- mon.no_reply(op);
- return (!num_new);
+ return false;
+
+ done:
+ mon.no_reply(op);
+ return true;
}
This reverts PR 61933. If the case of #54489 still needs a no_reply(), it belongs on the paths that end without any answer, not on every MLog. We have not tried to reproduce #54489.
Workaround¶
ceph mgr faildrops the queue of the active mgr. On the affected cluster its RSS went from 8.6 GiB to 340 MiB (same process, now standby). We now fail the mgr over once a week.- Other daemons drop their queue when they restart.
mon_cluster_log_level = infokeeps DBG entries out ofceph.log, but resent entries are still committed to the mon store.- We did not set
clog_to_monitors = false, because of #79444 (fixed by PR 71020).
Side note¶
LogClient::get_mon_log_message(true) sets last_log_sent = log_queue.front().seq, so the oldest queued entry is not resent: all our resent ranges start at seq 2. Probably harmless, but it looks like an off-by-one.
Environment¶
ceph version 19.2.3 (d74d168b1c80fb01e1a30d5e4ca9a45b12bc145b) squid (stable)on all daemons.- Two clusters, 4 monitors each, 1 active and 3 standby mgrs.
- Checked in the source: v19.2.2 and v18.2.7 still have the
return false;. v19.2.3 to v19.2.6, v20.2.0 to v20.2.4, v21.1.1, v18.2.8 and the heads of main, umbrella, tentacle, squid and reef do not. - Full traces available on request.
MM Updated by Mappia Mappia about 2 months ago
- Project changed from Ceph to RADOS
- Regression changed from No to Yes
RZ Updated by Radoslaw Zarzynski about 2 months ago
- Assignee set to Nitzan Mordechai
- Priority changed from Normal to High
NM Updated by Nitzan Mordechai about 2 months ago
- Related to Bug #81604: mon: zero-fsid MLog leaks a routed request; #61933 workaround drops all log acks for peon clients added
NM Updated by Nitzan Mordechai about 2 months ago
Tracker #81604 already suggested good solution for that issue, and it is under testing
RZ Updated by Radoslaw Zarzynski about 2 months ago
Thank you, @Nitzan Mordechai!
RZ Updated by Radoslaw Zarzynski about 1 month ago
- Related to deleted (Bug #81604: mon: zero-fsid MLog leaks a routed request; #61933 workaround drops all log acks for peon clients)
RZ Updated by Radoslaw Zarzynski about 1 month ago
- Is duplicate of Bug #81604: mon: zero-fsid MLog leaks a routed request; #61933 workaround drops all log acks for peon clients added
KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago
- Status changed from New to Duplicate