fix(native): make Windows instance shutdown cancellable - #120
Draft
Milky2018 wants to merge 1 commit into
Draft
Conversation
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
The Windows native smoke test can occasionally hang until the CI timeout while destroying the primary application instance. Normal runs finish in well under a second, so this is a lifecycle race rather than expected test duration.
The Windows single-instance listener used synchronous named-pipe operations. Shutdown attempted to interrupt the listener with
CancelSynchronousIoand then connected a temporary client to wakeConnectNamedPipe. There is a race where cancellation finds no pending I/O and the temporary connection happens before the listener creates its next pipe. The listener can then enter a new blockingConnectNamedPipecall, while destruction waits indefinitely for that thread.Changes
FILE_FLAG_OVERLAPPED.stop_event.FlushFileBuffersstep with an ACK receipt handshake so shutdown remains cancellable without risking premature disconnect.CancelSynchronousIoand temporary-client wakeup path.The public ABI and activation JSON format are unchanged.
Validation
moon fmtmoon infocmake --build native/build-engine --config Debugctest --test-dir native/build-engine -C Debug --output-on-failure(6/6 passed)The Windows-specific implementation cannot be executed on the current macOS host and requires Windows CI validation.