fix(runner): release the file teardown when Ctrl-C stops the run - #1332
Merged
Conversation
Ctrl-C killed the children, swept the temp dirs and exited without running the interrupted file's tear_down_after_script, so a file-scoped resource was leaked. The per-test tear_down already survived, through the test subshell's EXIT trap, which made the two halves of the pair behave differently for one signal. Settle the pending file teardown from the handler, reusing the debt #1321 introduced: after the kill, so the per-test hook still goes first as it does in a normal run, and before the temp-file sweep, so a hook reading a bashunit::temp_file still finds it. Reset SIGINT to its default disposition first. The hook is user code and may never return, and a handler that cannot itself be interrupted would leave no way out but SIGKILL. Verified by hand with a hook sleeping 60s: a second group-delivered Ctrl-C ends the run in ~2s. Covered by a unit test of the handler body rather than by signalling a real run. An acceptance test that did the latter failed 2 runs in 3 under a loaded --parallel suite, because delivery depends on job control and on which frame the shell is in when the signal lands. --parallel is untouched and still runs neither teardown on Ctrl-C. The parent cannot fix that: several files are in flight and each file's hook is redefined as the loop advances. Filed as #1331. Closes #1323
8 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.
🤔 Background
Related #1323
Ctrl-C killed the children, swept the temp dirs and exited without running the interrupted file's
tear_down_after_script. The per-testtear_downalready survived, through the test subshell's EXIT trap, so the two halves of the pair behaved differently for one signal.💡 Changes
--stop-on-failureskipstear_down_after_scriptin sequential runs #1321 introduced. After the kill, so the per-test hook still goes first as in a normal run; before the temp-file sweep, so a hook reading abashunit::temp_filestill finds it.--parallelsuite, since delivery depends on job control and on which frame the shell is in when the signal lands.--parallelis untouched and still runs neither teardown on Ctrl-C. The parent cannot fix that, because several files are in flight and each file's hook is redefined as the loop advances. Filed as Ctrl-C runs neither teardown under--parallel#1331.