fix(gateway): restart via service in containers - #25263
Closed
he-yufeng wants to merge 1 commit into
Closed
Conversation
Collaborator
Contributor
Heads up: duplicate of #25264PR #25264 solves the same issue (#25217) but takes a cleaner approach — it imports the existing Both PRs have test coverage. Worth consolidating into one. |
Author
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.
Summary
Closes #25217.
/restartcurrently uses a detached helper whenever the gateway is not running under systemd. That works for a normal shell process, but not for Docker/Podman: once the gateway exits as PID 1, the container stops and the detached helper goes with it.This routes container restarts through the existing service-restart path instead:
detached=False, via_service=Truedetached=False, via_service=TrueThe service path exits with the existing restart code, so a Docker/Podman restart policy such as
unless-stoppedoron-failurecan bring the container back.Tests
Result:
27 passed.Note: the full
tests\gateway\test_restart_drain.pyfile has an existing Windows-only failure intest_launch_detached_restart_command_uses_setsid: this Windows run enters thesys.executable -cdetached watcher branch, while that test expects the POSIXsetsid bashpath.