Repository navigation
hack/hero-demo: redirect stdin from /dev/null in wait_for_file - #673
Merged
Merged
Conversation
When ./hack/hero-demo/run.sh runs in an interactive terminal, wait_for_file invokes `AX_TIMEOUT=10 run_ax ssh ...` without redirecting stdin. GNU timeout places `ax ssh` in a background process group, and `ax ssh` (`Stdin: os.Stdin` in cmd/ax/main.go) reads from stdin. Reading from the controlling terminal in a background process group raises SIGTTIN, stopping `ax ssh` with SIGTERM pending and leaving its child `kubectl port-forward` open indefinitely. Redirect stdin from `/dev/null` on the `ax ssh` poll inside `wait_for_file` so interactive hero-demo runs do not stall on SIGTTIN. Verification: 1. Syntax check: `bash -n hack/hero-demo/run.sh` (exit 0). 2. Harness dry-run: `./hack/hero-demo/run.sh` (exit 0, prints scoreboard). 3. Controlling-PTY test (`pty.openpty()` + `TIOCSCTTY`) with mock `ax` calling `cat >/dev/null`: - Before fix: blocked until 1.5s watchdog kill (`rc=-9`). - After fix: completed cleanly (`rc=0`, `0.02s`).
Collaborator
Author
|
@yongruilin quick one if you have a sec? 3-line fix in wait_for_file, it hangs when run.sh is run from an interactive terminal |
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
/dev/nullon theax sshpoll insidewait_for_fileinhack/hero-demo/run.sh.Why
When
./hack/hero-demo/run.shruns in an interactive terminal,wait_for_filerunsAX_TIMEOUT=10 run_ax ssh .... GNUtimeoutputsax sshin a background process group, andax ssh(Stdin: os.Stdinincmd/ax/main.go) reads from stdin. Reading from the controlling terminal in a background process group raisesSIGTTIN, puttingax sshinto stopped state (T) withSIGTERMpending and leaving its childkubectl port-forwardopen indefinitely.Verification
bash -n hack/hero-demo/run.sh(exit 0)./hack/hero-demo/run.shdry-run (exit 0)pty.openpty()+TIOCSCTTY) with mockaxreading stdin (cat >/dev/null):rc=-9)</dev/null: completed cleanly (rc=0,0.02s)