ssh: Keep daemon alive while replacing options - #11408
Conversation
In OTP 27, daemon_replace_options/2 uses ssh_system_sup:replace_acceptor_options/2 to temporarily remove the daemon's acceptor supervisor while replacing the listening socket and its options. If the final active SSH connection terminates during this interval, ssh_system_sup can have no remaining significant children. Its all_significant auto-shutdown policy then stops the daemon before the replacement acceptor is started, causing the operation to exit with noproc. Add a temporary significant guard child around OTP 27's acceptor replacement path. The guard keeps ssh_system_sup alive until the new acceptor is running and is always removed afterward, preserving the daemon's normal shutdown behavior outside the replacement window. Add a deterministic Common Test case that pauses replacement after the listener is stopped, closes the final connection, and verifies that daemon_replace_options/2 succeeds, the daemon remains alive, and its information remains available. The test reproduced the noproc failure before rebuilding SSH with the fix and passed after the patched SSH application was rebuilt.
CT Test ResultsTests are running... https://github.com/erlang/otp/actions/runs/30563450909 Results for commit 2d0a10c To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
|
Sorry, I could have done that for you. I was starting with 27 to see if I got through that. Thanks |
No worries, thanks for creating the branch. I will close this PR in favor of #11399, since maint-XX branches are not development branches, so we will not merge anything there. Your branch will be merged as part of the release process (when next patch release is created), but this PR is not required, we only need the branch. Thanks :) |
In OTP 27, daemon_replace_options/2 uses
ssh_system_sup:replace_acceptor_options/2 to temporarily remove the daemon's acceptor supervisor while replacing the listening socket and its options.
If the final active SSH connection terminates during this interval, ssh_system_sup can have no remaining significant children. Its all_significant auto-shutdown policy then stops the daemon before the replacement acceptor is started, causing the operation to exit with noproc.
Add a temporary significant guard child around OTP 27's acceptor replacement path. The guard keeps ssh_system_sup alive until the new acceptor is running and is always removed afterward, preserving the daemon's normal shutdown behavior outside the replacement window.
Add a deterministic Common Test case that pauses replacement after the listener is stopped, closes the final connection, and verifies that daemon_replace_options/2 succeeds, the daemon remains alive, and its information remains available.
The test reproduced the noproc failure before rebuilding SSH with the fix and passed after the patched SSH application was rebuilt.