forked from loft-sh/devpod
-
Notifications
You must be signed in to change notification settings - Fork 27
fix: flush tunnel logger before agent shutdown #762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
skevetter
merged 9 commits into
skevetter:main
from
terenho-jobber:fix/tunnel-logger-flush-on-shutdown
Jun 3, 2026
+180
−56
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
34a0e3e
fix: flush tunnel logger before agent shutdown
terenho-jobber 10baeec
fix: satisfy funcorder lint, move unexported logger methods to end
terenho-jobber 7e0944a
refactor: use named tunnelserver.Flusher interface for log flush
terenho-jobber b2a189a
test(e2e): guard against dropped final lifecycle hook log line
terenho-jobber 40deba7
test(e2e): emit a burst before the marker so the drop reproduces
terenho-jobber 1672e8b
test(e2e): move lifecycle hook to a script to avoid marker leak
terenho-jobber 8c37275
fix: gate logger Flush on worker completion, not ctx cancellation
terenho-jobber 25ef54c
fix: bound logger Flush by a single overall deadline
terenho-jobber d25ac66
style: shfmt postCreateCommand.sh fixture (4-space indent)
terenho-jobber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
5 changes: 5 additions & 0 deletions
5
e2e/tests/up/testdata/docker-lifecycle-stderr/.devcontainer/devcontainer.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "lifecycle-stderr", | ||
| "image": "mcr.microsoft.com/devcontainers/go:1", | ||
| "postCreateCommand": "sh .devcontainer/postCreateCommand.sh" | ||
| } |
21 changes: 21 additions & 0 deletions
21
e2e/tests/up/testdata/docker-lifecycle-stderr/.devcontainer/postCreateCommand.sh
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/bin/sh | ||
| # Regression fixture for the dropped-last-line bug (see the e2e spec | ||
| # "forwards the final lifecycle hook log line before the agent exits"). | ||
| # | ||
| # Emit a burst of stderr lines ending with a marker, then fail. The agent | ||
| # forwards lifecycle hook output over the tunnel asynchronously; the burst | ||
| # keeps the sender busy so the marker is still queued when the hook exits | ||
| # non-zero. Without the flush-on-shutdown fix the agent tears down before the | ||
| # marker is sent and it is dropped (the observed drain window is only ~11 | ||
| # lines, so the 300-line burst leaves a wide margin). | ||
| # | ||
| # The marker lives in this script rather than the inline postCreateCommand so | ||
| # it cannot leak into devpod's "failed to run <command>" error message and | ||
| # produce a false positive. | ||
| i=0 | ||
| while [ "$i" -lt 300 ]; do | ||
| echo "filler line $i" >&2 | ||
| i=$((i + 1)) | ||
| done | ||
| echo DEVPOD_LIFECYCLE_FLUSH_MARKER >&2 | ||
| exit 1 |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.