Make interchange threads daemons for less-hangy exit #2637
Merged
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.
When the interchange is killed by SIGINT/Ctrl-C, the main thread exits (due to a SIGINT generated KeyboardInterrupt exception) but the other two interchange threads do not. This means that the interchange process hangs without exiting.
With the behaviour introduced by this PR, the main thread ending will now cause the (now daemon) threads to end too.
This behaviour is different from the SIGTERM behaviour (which is how a clean parsl shutdown happens) - a SIGTERM kills all threads without opportunity for catching the exit, in the current signal handler configuration.
To recreate:
run:
press ctrl-C after a while
observe a hang and that the interchange process is still alive.
After this PR,
observe a hang and that the interchange process has terminated.
The pytest hang in this post-PR situation comes from a couple of other places at least, that this PR does not address, but it's no longer in the interchange.
Type of change