fix: stop orphaned mock on healthcheck timeout#129
Open
outofcoffee wants to merge 1 commit into
Open
Conversation
On a healthcheck timeout, WaitForOp called logger.Fatalf, terminating the CLI via os.Exit before engine shutdown ran. This left the just-started mock orphaned: process engines reparented their child to init, and the docker engine left its container running in dockerd. WaitForOp now reports a timeout (returning false plus a timedOut flag) instead of exiting. Each engine stops the mock it started when the healthcheck times out, and `up` exits non-zero only for genuine failures, distinguishing a timeout from a Ctrl+C abort via the interrupt flag. https://claude.ai/code/session_01V2yVKgX16c7eLrTXtSVQs4
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.
Stop the just-started mock when the engine fails to become healthy within the start timeout, so a failed
imposter upno longer leaks a process or container.Summary
WaitForOp/WaitForUrl/WaitUntilUpno longer calllogger.Fatalfon timeout; they now return an extratimedOut boolso callers can distinguish a healthcheck timeout from an external abort and clean up accordingly.--detach=healthypath).cmd/up.gorecords whetherCtrl+Cfired before cleanup, then exits non-zero on a genuine failed start while still returning cleanly on an interrupt.internal/engine/health_test.gocovering the threeWaitForOpoutcomes (success, timeout-without-exit, abort).Closes #123
Implementation details
The
interruptedflag intrapExitis set beforeStopImmediatelyruns, so by the timeStartreturns and the main thread reads the flag, it reliably reflects whether the false return came from a signal or from a timeout. This avoids double-stopping in the abort case (whereStopImmediatelyalready kills the mock) while still cleaning up in the timeout case (where the engine itself callsStop).