fix(process): register interrupt handler before raising in windows test - #768
Merged
Conversation
The child branch called SendInterrupt() with nothing watching SIGINT, so runtime.ctrlHandler could not consume the CTRL_BREAK_EVENT and Windows ran the default action instead, killing the child with STATUS_CONTROL_C_EXIT (0xc000013a). Delivery is asynchronous, so the test passed only when the child's return beat the handler thread -- i.e. when the interrupt arrived too late to matter. Register signal.Notify before raising and wait for the signal, matching interrupt_unix_test.go. This removes the race and makes the test actually assert that SendInterrupt delivers an interrupt. Fixes #767
Mzack9999
approved these changes
Aug 26, 2026
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.
Fixes #767
TestSendInterruptis flaky onwindows-latest, and as written it is green only whenSendInterruptis too slow to matter.The child branch raised the event with nothing watching
SIGINT:runtime.ctrlHandlermapsCTRL_BREAK_EVENTtoSIGINTbut only consumes it when a handler is registered (if sigsend(s) { return 1 }). With no handler it returns 0 and Windows runs the default action — terminate withSTATUS_CONTROL_C_EXIT(0xc000013a). Delivery is asynchronous, so it was a race between the handler thread and the child'sreturn; the failing log shows the child emitting bothPASSandexit status 0xc000013a.This registers
signal.Notifybefore raising and waits for the signal, matching whatinterrupt_unix_test.goalready does. The race is gone (the handler consumes the event instead of the default action) and the test now asserts the thing it is named after. The parent-side re-exec withCREATE_NEW_PROCESS_GROUPis untouched — that is what keeps the break event away from sibling processes duringgo test ./....GOOS=windows go vet ./process/is clean; the behaviour itself needs the Windows runner to confirm, so watch this PR'sTest Builds (windows-latest)job.