Trap EXIT to deregister runner when runner exits by itself#582
Open
jonathan528i wants to merge 6 commits intomyoung34:masterfrom
Open
Trap EXIT to deregister runner when runner exits by itself#582jonathan528i wants to merge 6 commits intomyoung34:masterfrom
jonathan528i wants to merge 6 commits intomyoung34:masterfrom
Conversation
Owner
|
The new test looks like theres a race condition to pass |
Author
My best guess is due to the I've updated the code but we'll have to see if that fixes the tests once the pipeline runs again. |
Owner
|
Seems to always fail for arm64 |
Owner
|
My concern is how flakey these tests are; arm64 fails consistently |
myoung34
requested changes
Apr 15, 2026
| } | ||
|
|
||
| deregister_runner() { | ||
| COMMAND_EXIT_CODE=$? |
Owner
There was a problem hiding this comment.
the issue here is 2 things:
- that EXIT doesnt trap signals
- qemu is doing something differently with how EXIT works here (why arm64 only, cant confirm what though)
Suggested change
| COMMAND_EXIT_CODE=$? | |
| local COMMAND_EXIT_CODE="${1:-EXIT}" | |
| echo "Caught ${COMMAND_EXIT_CODE} - Deregistering runner" |
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.
Currently, if the runner application crashes or exits natively with an error (e.g., exit code
1), thederegister_runnerfunction inentrypoint.shis never called. This leaves orphaned runner instances in github. Closes #581.The current trap code only looks for external signals to kill/stop the runner process, but not when the runner process exits by itself. By also trapping
EXIT, we can ensurederegister_runneris called whenever the runner exits.Changes
entrypoint.sh: AddedEXITto thetrap_with_arglist so the script guarantees deregistration regardless of how the container's main process terminates.goss_trap_exit.yaml: Added a new test to validate if exit code 1 is received, that deregister happens correctly..github/workflows/test.yml: Integrated the new test into the CI pipeline for both Ubuntu and Debian builds.Testing
Locally ran the new test without the change to trap and verified it failed. Re-ran the test with the change and verified it passes. Also ran
goss_full.yamlandgoss_reusage_failto ensure the change didn't break existing tests.