Skip to content

mgr/MgrClient: send keepalives on the mgr session - #72720

Merged
anthonyeleven merged 1 commit into
ceph:mainfrom
anthonyeleven:wip-mgrc-keepalive
Nov 1, 2026
Merged

anthonyeleven merged 1 commit into
ceph:mainfrom
anthonyeleven:wip-mgrc-keepalive

Conversation

@anthonyeleven

@anthonyeleven anthonyeleven commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes: https://tracker.ceph.com/issues/81784

The mgr sends nothing back on a daemon's lossy mgr session, and AsyncConnection's idle check counts only received traffic. So every OSD and MDS faults its mgr session once it has been open for ms_connection_idle_timeout, even though it reports every mgr_stats_period seconds. It then reconnects, authenticates again and declares all of its perf counters again. Daemons that connected together after a mgr failover stay in step, so they all reconnect to the mgr at the same moment.

MonClient avoids this by sending keepalives. After a report, MgrClient now sends one if half of the daemon's own ms_connection_idle_timeout has passed since the last, so the ack arrives well before the timeout. With the default 900 s timeout that is one keepalive every 450 s, not one per report. The mgr's messenger answers the keepalive itself, so nothing new reaches the mgr's dispatch path.

An earlier revision sent the keepalive from the mgr, so that daemons of any release would be fixed once the mgrs were upgraded. It is back in MgrClient because the daemon's idle timer is what closes the session, and only the daemon knows that timer's setting.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

Signed-off-by: Anthony D'Atri [email protected]
Assisted-by: Claude Opus-5.5

@anthonyeleven
anthonyeleven marked this pull request as ready for review October 16, 2026 02:33
@anthonyeleven
anthonyeleven requested a review from a team as a code owner October 16, 2026 02:33
@anthonyeleven anthonyeleven changed the title mgr: send a keepalive with each MgrClient report mgr: send a keepalive in reply to each daemon report Oct 18, 2026

@NitzanMordhai NitzanMordhai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anthonyeleven please see my comment, you also missing the Fixes line in the commit message

Comment thread src/mgr/DaemonServer.cc Outdated
// Nothing else flows back to the daemon on this session, and the
// messenger's idle check counts only received traffic, so without this
// the daemon faults the session every ms_connection_idle_timeout.
m->get_connection()->send_keepalive();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we will send keepalive for each report every mgr_stats_period (5s by default) from now on? and also recive another ack. Maybe we can think of idle time to send it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. Each one is small, a KEEPALIVE2 frame that the daemon's messenger acks without dispatching anything, about what MonClient already sends every mon_client_ping_interval. But one per report is more than the idle check needs.

805ee03 now records on the MgrSession when the mgr last sent a keepalive, and sends one with a report only once half of ms_connection_idle_timeout has passed since. At the defaults that's one keepalive and one ack per daemon every 450 s instead of every 5 s, and the daemon's idle timer never gets more than about 455 s old against its 900 s limit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to a quarter of ms_connection_idle_timeout in 8b14903. The mgr can only see its own timeout, and at half, a daemon whose timeout is set lower than the mgr's would still reset: with the mgr at 900 s, anything below about 455 s. A quarter covers daemons down to about 230 s. At the defaults that's one keepalive per daemon every 225 s instead of every 5 s.

@anthonyeleven anthonyeleven changed the title mgr: send a keepalive in reply to each daemon report mgr: send keepalives on daemon report sessions Oct 19, 2026
@anthonyeleven

Copy link
Copy Markdown
Contributor Author

@NitzanMordhai Added Fixes: https://tracker.ceph.com/issues/81784 to the commit message, just before Signed-off-by. Since the keepalive no longer goes out with every report, I also retitled the commit and the PR to "mgr: send keepalives on daemon report sessions".

@NitzanMordhai NitzanMordhai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/mgr/DaemonServer.cc Resolved
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath10-testing-20261027.070130-main.

@anthonyeleven anthonyeleven changed the title mgr: send keepalives on daemon report sessions mgr/MgrClient: send keepalives on the mgr session Oct 28, 2026
@anthonyeleven

Copy link
Copy Markdown
Contributor Author

@idryomov @NitzanMordhai Reworked in f3a1645. The keepalive is back in MgrClient, as Ilya asked, and goes out only once half of the daemon's own ms_connection_idle_timeout has passed since the last one, following Nitzan's idle-time suggestion. With the defaults that is one keepalive every 450 s instead of one per 5 s report. The mgr-side change and MgrSession::last_keepalive are gone. Could you both take another look?

@SrinivasaBharath this replaces the commit that is in wip-bharath10-testing-20261027.070130-main.

@idryomov idryomov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

Comment thread src/mgr/MgrClient.cc Resolved
The mgr sends nothing back on a daemon's lossy mgr session, and
AsyncConnection's idle check counts only received traffic. So every OSD
and MDS faults its mgr session once it has been open for
ms_connection_idle_timeout, even though it reports every
mgr_stats_period seconds. It then reconnects, authenticates again and
declares all of its perf counters again. Daemons that connected
together after a mgr failover stay in step and reconnect together.

MonClient avoids this by sending keepalives. After a report, send one
if half of the daemon's own ms_connection_idle_timeout has passed since
the last, so the ack arrives well before the timeout. With the default
900 s timeout that is one keepalive every 450 s, not one per report.

Fixes: https://tracker.ceph.com/issues/81784
Co-authored-by: Ilya Dryomov <[email protected]>
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus-5.5
@anthonyeleven

Copy link
Copy Markdown
Contributor Author

Squashed @idryomov's suggestion into the one commit (f789dbd), with a Co-authored-by line for him. The tree is unchanged.

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath18-testing-20261029.065635-main.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@anthonyeleven
anthonyeleven merged commit b88220a into ceph:main Nov 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants