Skip to content

mgr/PyModuleRegistry: compare the module set this manager reads - #72804

Merged
tchaikov merged 1 commit into
ceph:mainfrom
tchaikov:wip-mgr-always-on-modules-compare
Nov 5, 2026
Merged

tchaikov merged 1 commit into
ceph:mainfrom
tchaikov:wip-mgr-always-on-modules-compare

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor

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

PyModuleRegistry::handle_mgr_map() compares the always_on_modules map the
monitors write, while MgrMap::get_always_on_modules() picks the single entry
out of it that this manager reads, keyed on the manager's own compiled-in
release. An entry for any other release cannot change what this manager runs,
so a release key being added reads as a change to its own module set, and the
manager respawns and re-initialises all of its Python modules for nothing.

Every release adds such a key, as doc/dev/release-checklists.rst asks, so
this fires on every major upgrade: the first monitor of the new release to
become leader rewrites the field from MgrMonitor::on_active(), and every
manager respawns at that moment, the active one included. That leaves the
cluster without a manager in the middle of the rolling monitor restart, and on
a cephadm cluster the active manager is the orchestrator running the upgrade.

The branch of the same function that handles the first mgrmap already uses the
accessor, and Mgr::got_mgr_map() compares only modules.

Reproduced with vstart

One monitor built with the CEPH_RELEASE_UMBRELLA entry removed from
always_on_modules(), then restarted with the entry present, restarting only
the monitor so the manager keeps its stored mgrmap:

manager pre-swap post-swap
before this patch epoch 3, 0 respawns epoch 6, 1 respawn, new process
with this patch epoch 3, 0 respawns epoch 4, 0 respawns, same pid and starttime

In both runs the monitor logged always on modules changed exactly once and
the table went from octopus,pacific,quincy,reef,squid,tentacle to that plus
umbrella, while all seven per-release entries hold the identical module
list, so nothing the manager consumes changed.

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)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

handle_mgr_map() compares the always_on_modules map the monitors write,
while MgrMap::get_always_on_modules() picks the single entry out of it
that this manager reads, keyed on the manager's own compiled-in release.
An entry for any other release cannot change what this manager runs, so
a release key being added reads as a change to its own module set, and
the manager respawns and re-initialises all of its Python modules for
nothing.

Every release adds such a key, as doc/dev/release-checklists.rst asks,
so this fires on every major upgrade. MgrMonitor::on_active() proposes a
new mgrmap whenever the leader's compiled-in table differs from the
stored one, so the first monitor of the new release to become leader
rewrites it, and every manager respawns at that moment, the active one
included. That leaves the cluster without a manager in the middle of the
rolling monitor restart, which is also when the binary a manager would
re-exec has just been replaced on disk. A leader change back to a
monitor of the old release rewrites the table again, so an interrupted
or retried restart repeats it.

Compare what the manager consumes. The branch of the same function that
handles the first mgrmap already uses the accessor.

Fixes: https://tracker.ceph.com/issues/81858
Related-to: https://tracker.ceph.com/issues/81856
Signed-off-by: Kefu Chai <[email protected]>
@tchaikov

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@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!

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

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

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@tchaikov
tchaikov merged commit 7059fae into ceph:main Nov 5, 2026
17 of 18 checks passed
@tchaikov
tchaikov deleted the wip-mgr-always-on-modules-compare branch November 5, 2026 08:56
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.

3 participants