Repository navigation
fix(testing): resolve result pipe drain promptly on cancellation - #26231
Open
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
Open
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
Conversation
Fixes microsoft#26217 On non-Windows platforms (especially macOS), non-blocking FIFO sockets do not emit an end or close event when the python subprocess writer exits. Because the server close deferred previously relied exclusively on reader.onClose after PR microsoft#25981, test runs always waited for the full RESULT_PIPE_DRAIN_TIMEOUT_MS (5 seconds) to expire. This change starts a short drain grace timer (100ms) upon cancellation or subprocess completion (via cancellationToken.onCancellationRequested) so buffered messages can finish draining while ensuring the result pipe resolves promptly without hanging on systems where reader.onClose does not fire.
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 #26217
Description
On non-Windows platforms (especially macOS), non-blocking FIFO sockets do not emit an
endorcloseevent when the Python subprocess writer exits. BecausestartRunResultNamedPipepreviously relied solely onreader.onCloseto resolvedeferredTillServerClose, pytest runs always hung untilawaitDeferredWithTimeouthit the 5,000msRESULT_PIPE_DRAIN_TIMEOUT_MSfallback, adding an unnecessary 5-second delay to every test run.Changes
src/client/testing/testController/common/utils.ts:RESULT_PIPE_DRAIN_GRACE_PERIOD_MS = 100.cancellationTokenis cancelled (triggered either by user cancellation or when the subprocess finishes and invokesserverCancel.cancel()), start a 100ms drain grace timer to allow buffered messages to be received before disposing the pipe and resolvingdeferredTillServerClose.reader.onClosefires before the grace period (e.g. on Windows/Linux), the drain timer is cleared and the pipe is disposed immediately.src/test/testing/testController/utils.unit.test.tsverifying prompt resolution under cancellation when the reader does not emit close events.