Bug #81856
closeddaemons respawn into the binary an upgrade replaced
0%
Description
A daemon that respawns while its binary is being replaced either exits without logging anything or keeps running without doing its job. The unit looks healthy either way.
What it looks like when it fires:
- the unit stays active (running) with the pid it had before, since execv() keeps the pid, so the service manager sees no state change
- the daemon either exits before it can log anything, or runs an old binary against new libraries
- starting the unit does nothing, since systemd already has it started. Only a stop and start, or systemctl restart, replaces the process
- while no manager is active, health reports MGR_DOWN, "no active mgr", as HEALTH_WARN, and as HEALTH_ERR once mon_mgr_inactive_grace passes with no new mgrmap committed
The motivating case was a tentacle to umbrella upgrade on a three-node cluster, where after the monitors were restarted and before the managers were, ceph -s reported "mgr: no daemons active" while systemctl reported the units as running, and a stop and start brought them back. The manager logs from that window were not available, so that report is consistent with this failure rather than a confirmed instance of it. Whether a given re-exec dies on a missing symbol or comes up on mismatched libraries depends on the release pair, so the outcome is not deterministic.
MgrStandby::respawn(), MDSDaemon::respawn() and Monitor::respawn() exec /proc/self/exe rather than the path it points to, so that a respawn works after the executable has been unlinked:
/* Determine the path to our executable, test if Linux /proc/self/exe exists. * This allows us to exec the same executable even if it has since been * unlinked. */
Replacing the binary unlinks it too, so after a package upgrade the re-exec runs the old image while the dynamic linker takes libceph-common.so and the rest from disk, where the upgrade replaced them. Either the link fails and the process exits before it can log anything, as in #41513:
ceph-mgr: symbol lookup error: ceph-mgr: undefined symbol: _ZTIN4ceph6buffer5errorE
or it succeeds and an old binary runs against new libraries. In the first case Restart=on-failure does bring the daemon back, on the new binary.
A manager meets this on every major upgrade. Each release adds a key to MgrMonitor::always_on_modules(), the first monitor of the new release to become leader rewrites that field in the mgrmap, and PyModuleRegistry::handle_mgr_map() compares the raw map instead of MgrMap::get_always_on_modules(), so every mgr reads it as a change to its own module set and respawns. Since the upgrade procedure restarts the monitors before the managers, that lands after the package upgrade and before the mgr restart.
The MDS can respawn with no upgrade in progress: MDSIOContextBase::complete() respawns on -EBLOCKLISTED and -ETIMEDOUT, MDSRank on damage, on removal from the MDSMap and on standby transitions.
#41513 reported this in 2019 and was closed with a QA change, 4205964a15f ("qa/tests: adding mgr.x into the restart/upgrade sequence before monitors"), so squid, tentacle and umbrella all still have it.
A daemon respawns with the code it is running, so the fix only helps on an upgrade out of a release that already carries it. That is what the backports are for.
KC Updated by Kefu Chai about 2 months ago
- Subject changed from daemons respawn into the binary an upgrade just replaced to daemons respawn into the binary an upgrade replaced
- Description updated (diff)
KC Updated by Kefu Chai about 2 months ago
- Backport changed from squid,tentacle to squid,tentacle,umbrella
KC Updated by Kefu Chai about 2 months ago
- Description updated (diff)
KC Updated by Kefu Chai about 2 months ago
- Description updated (diff)
KC Updated by Kefu Chai about 2 months ago
- Status changed from New to Fix Under Review
- Assignee set to Kefu Chai
- Pull request ID set to 72805
KC Updated by Kefu Chai about 2 months ago
- Description updated (diff)
KC Updated by Kefu Chai about 2 months ago
- Description updated (diff)
KC Updated by Kefu Chai about 1 month ago
I reproduced this on a 20.2.4 to 21.1.2 upgrade. Instead of a symbol lookup error, the re-exec hangs.
After the first 21.1.2 mon becomes leader, all mgrs respawn into the deleted 20.2.4 binary, which then loads the 21.1.2 libceph-common. The old binary's inlined ConfigProxy code locks cct+0x3b30, while the new library keeps ConfigProxy::lock at cct+0x3bb0 , becauseConfigValues has 31 more with_legacy members. So the old code waits on memory that is not a lock. It has one thread and logs nothing, since this happens before the log starts:
#1 pthread_mutex_lock #2 global_pre_init() /usr/bin/ceph-mgr (deleted) #3 global_init() #4 main
The pid stays the same, so systemd still reports the unit as active, and the cluster shows "mgr: no daemons active" until someone restarts the mgrs by hand. The restart recovers them.
UB Updated by Upkeep Bot 28 days ago
- Copied to Backport #82717: tentacle: daemons respawn into the binary an upgrade replaced added
UB Updated by Upkeep Bot 28 days ago
- Copied to Backport #82718: squid: daemons respawn into the binary an upgrade replaced added
UB Updated by Upkeep Bot 28 days ago
- Copied to Backport #82719: umbrella: daemons respawn into the binary an upgrade replaced added
UB Updated by Upkeep Bot 28 days ago
- Status changed from Fix Under Review to Backporting
- Merge Commit set to fd479980aa2d5b6b563f95024e9b814c8870fa97
- Fixed In set to v22.0.0-462-gfd479980aa
- Upkeep Timestamp set to 2026-11-05T08:59:54+00:00