shut down supervisord with SIGTERM instead of using supervisorctl#470
Merged
SuperSandro2000 merged 1 commit intomicrovm-nix:mainfrom Feb 17, 2026
Merged
Conversation
supervisord interprets SIGTERM as exit request and will shut down the services. Setting KillMode=mixed ensures that systemd does not kill the virtiofsd+notify processes (supervisord will do that). This commit also drops the autorestart=true from the virtiofsd instances. Since virtiofsd exits on its own with exit code 0 when the VM exits, we do not want supervisord to restart it only to kill it again when the VM has shut down and systemd shuts this service down. Since the default autorestart is "unexpected", supervisord should still restart virtiofsd after abnormal (non-0) exits. Next to being useless, I've observed (unfortunately without being able to reliably reporduce) that the restart-and-immediately-kill often leads to the virtiofsd process seemingly ignoring the SIGTERM (probably it if is sent before the execve(2), where the supervisord signal handler is still in place). Hence, supervisord waits for virtiofsd to exit for multiple seconds before timing out and killing it, slowing down the shutdown duration. Why this change? supervisorctl fails with "connection refused", so that shutting down this service means waiting for systemd to time out. AFAICT from the docs, supervisorctl needs supervisord to be listening on a unix or HTTP socket, which only happens if explicitly configured, which is not the case.
SuperSandro2000
approved these changes
Feb 17, 2026
Member
SuperSandro2000
left a comment
There was a problem hiding this comment.
Tested this on our installation and did not observe an immediate difference, but that's probably good as we remove quirky stuff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
supervisord interprets SIGTERM as exit request and will shut down the services. Setting KillMode=mixed ensures that systemd does not kill the virtiofsd+notify processes (supervisord will do that).
This commit also drops the autorestart=true from the virtiofsd instances. Since virtiofsd exits on its own with exit code 0 when the VM exits, we do not want supervisord to restart it only to kill it again when the VM has shut down and systemd shuts this service down. Since the default autorestart is "unexpected", supervisord should still restart virtiofsd after abnormal (non-0) exits.
Next to being useless, I've observed (unfortunately without being able to reliably reporduce) that the restart-and-immediately-kill often leads to the virtiofsd process seemingly ignoring the SIGTERM (probably it if is sent before the execve(2), where the supervisord signal handler is still in place). Hence, supervisord waits for virtiofsd to exit for multiple seconds before timing out and killing it, slowing down the shutdown duration.
Why this change? supervisorctl fails with "connection refused", so that shutting down this service means waiting for systemd to time out. AFAICT from the docs, supervisorctl needs supervisord to be listening on a unix or HTTP socket, which only happens if explicitly configured, which is not the case.