Conversation
The gateway runs as a systemd user service with Restart=on-failure and RestartSec=5s, so a gateway that fails during startup never settles in a final "failed" state: systemd keeps cycling it through "auto-restart", and a 5s delay never trips the start limit that would eventually leave it failed. The listener probe therefore burned its whole 30s timeout on a gateway that could never start, and its last line reported a bare listener timeout even though the gateway's own error was in the diagnostics printed just above it. Probe the unit on every pass of the wait loop. A final "failed" unit, and an "auto-restart" unit whose NRestarts has grown past the count taken before the installer restarted it, both end the wait early. The comparison is against that baseline so a unit that only failed during an earlier run is still waited on, and starting or running units are never treated as failures. macOS and snap installs keep their existing behaviour: the check is limited to Linux non-snap installs, which is the only path that runs the gateway as a systemd user service. On failure the last line now names the service and gives the command to retry it, after the diagnostics have already shown the gateway's error. Closes NVIDIA#4040 Signed-off-by: Yi-111-a <153097222+Yi-111-a@users.noreply.github.com>
Yi-111-a
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
October 2, 2026 00:20
|
Thank you for your interest in contributing to OpenShell, @Yi-111-a. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
4 of 6 tasks
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
The installer now stops waiting as soon as the
openshell-gatewayuser servicefails during startup, instead of burning its full 30s listener timeout on a
gateway that can never start.
Related Issue
Closes #4040
Changes
install.sh: addedgateway_user_service_fieldandgateway_user_service_failed.The gateway is a systemd user service with
Restart=on-failureandRestartSec=5s, so a gateway that fails during startup never settles in afinal
failedstate: systemd keeps cycling it throughauto-restart, and a 5sdelay never trips the start limit that would eventually leave it failed. The
probe therefore only saw a listener that never opens.
start_user_gatewaynow recordsNRestartsbefore restarting the unit.NRestartsis never reset by a restart, so reading it first is what lets thecheck tell a failure from this install apart from one left over from an
earlier run.
wait_for_local_gateway_listenerchecks the unit on every pass of the waitloop. A final
failedunit, and anauto-restartunit whoseNRestartshasgrown past that baseline, both end the wait early. The check runs on every
pass, including the passes where the mTLS bundle check short-circuits.
The final line now names the service and gives the command to retry it, after
dump_local_gateway_diagnosticshas already printed the gateway's own error:Per the issue, this only stops the installer from waiting. It does not stop the
unit's restart loop and does not pre-check for Docker or Podman.
macOS and snap installs are unchanged: the check is limited to Linux non-snap
installs, which is the only path that runs the gateway as a systemd user service.
macOS goes through the same
wait_for_local_gateway_listenerbut is aHomebrew/
launchdservice, and snap has its ownwait_for_snap_gateway_listener.Testing
mise run test:install-shcovers all four unit shapes the issue asks for —failed, restarting after a failure, starting, and running — plus a restart loop
that predates the installer's own restart, a missing baseline, a non-numeric
restart count, macOS, and snap.
The regression is covered directly: with the in-loop check removed the probe
waits the full 30s, and the new timing assertion fails with
the listener probe waited 30s on a failed gateway unit. With the fix the samecase completes in under 5s.
Verified locally:
$ sh -n install.sh # POSIX sh syntax $ bash tasks/scripts/test-install-sh.sh install.sh focused tests passed $ shellcheck -s sh install.shinstall.shreports the same two pre-existingSC2016notes before and afterthis change, and no new findings.
test-install-sh.shgains only theSC2034/SC2329notes already present in that file for variables and overridefunctions consumed by the sourced
install.sh(the same notes asOPENSHELL_SNAP_TLS_DIRat line 496 andUPGRADE_NOTICE_ACKat line 201).