2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 20:17:55 +00:00

fix(xcat-core): the respawned monitor holds client sockets open for good

The respawn is forked from the middle of the service loop, so the child
inherits @pendingconnections -- the client sockets the parent has accepted and
not yet handed to a worker. The monitor never serves one, and it outlives the
worker that does, so its copy keeps that client's socket open until the daemon
exits.

Close them in the child, next to the listener and the rescanplugins channel it
already drops.

xcatd_install_monitor.t runs the lifted respawn block against stand-in
descriptors and requires every pending connection to be closed. It fails
without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-09-03 09:08:36 -03:00
parent b7c1461f9b
commit 424f297d4b
+5
View File
@@ -1518,6 +1518,11 @@ until ($quit) {
# would differ from the one forked at startup.
close($chreadpipe);
close($chwritepipe);
# A pending connection is a client socket the parent has accepted and not yet
# handed to a worker. The monitor never serves one, and it outlives the worker
# that does, so a copy left open here holds that client's socket for the life of
# the daemon.
close($_) for @pendingconnections;
do_installm_service;
xexit(0);
} state => \$mon_respawn, pid => \$pid_MON, now => time();