Repository navigation
Fix deadlock waiting on serverSocket - #2740
Merged
Merged
Conversation
On Windows the `subscription.cancel()` waits for an OS interaction that never occurs and `stream.first` returns a Future that does not complete until the cancellation completes. Unskip tests on windows failing for this reason.
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
…n times in concurrent test
brianquinlan
approved these changes
Aug 31, 2026
brianquinlan
left a comment
Contributor
There was a problem hiding this comment.
That's a bit ugly but I don't have a better solution.
| var socket = await serverSocket.first; | ||
| ``` | ||
|
|
||
| On Windows, this interacts with two platform-level behaviors: |
Contributor
There was a problem hiding this comment.
Optional: Are you going to clean up this text when your SDK fix is live? Maybe you could just point to an issue?
Member
Author
There was a problem hiding this comment.
I think it would be OK to drop the whole directory after the min SDK dependency has a fix.
| } | ||
|
|
||
| // TODO(https://github.com/dart-lang/sdk/issues/64166) remove when the min SDK | ||
| // does not leak sockets to subproceesses. |
Contributor
There was a problem hiding this comment.
You could add the note to remove the test or at least remove the docs for the test here.
Member
Author
There was a problem hiding this comment.
Added a note to remove the test.
natebosch
added a commit
that referenced
this pull request
Sep 2, 2026
Work around, and reduce the odds of triggering, a bug in the Dart SDK implementation of unix domain sockets on windows. dart-lang/sdk#64166 On windows in Dart sockets are being inherited by subprocesses, so spawned test processes (like the chrome browser) would inherit them, and subsequently after receiving a connection the socket cancel would never complete (waiting on subprocess which inherited the socket to exit) so the `Stream.first` future would also never complete. This surfaced as a deadlock only in the case where a browser startup happens while the socket server is waiting for the first connection. Drastically reduce the odds of this situation by waiting to bind the socket server until the subprocess is about to start, instead of listening on the socket during the compilation process as well. Work around the situation in case it still happens with a `fastFirst` extension which behaves like `first` except it explicitly does not await the Future returned from `cancel`. Add an integration test which demonstrates the conditions required to trigger the bug. We can remove this after the SDK is fixed.
natebosch
added a commit
to dart-lang/ai
that referenced
this pull request
Sep 4, 2026
Closes dart-lang/test#2688 The deadlock was caused by an interaction between chrome and exe tests where the chrome process was inheriting the socket server bound to communicate with the exe test. Workaround landed in dart-lang/test#2740
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Sep 4, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart test`. test (https://github.com/dart-lang/test/compare/55b186d..18ef597): 18ef5978 Fri Sep 4 10:13:39 2026 -0700 Nate Bosch Add support for collapsed error messages (dart-lang/test#2651) 6783445c Wed Sep 2 16:46:04 2026 -0700 Nate Bosch Prepare to publish (dart-lang/test#2737) 8de693e1 Tue Sep 1 03:54:15 2026 +0000 dependabot[bot] Bump the github-actions group with 2 updates (dart-lang/test#2744) 575e4dad Mon Aug 31 17:01:46 2026 -0700 Nate Bosch Fix deadlock waiting on serverSocket (dart-lang/test#2740) bd9acf32 Thu Aug 27 22:53:54 2026 -0700 Nate Bosch Unskip a test on windows (dart-lang/test#2741) b575eda9 Thu Aug 27 17:16:16 2026 -0700 Nate Bosch Remove redundant tag (dart-lang/test#2738) d21b06cb Thu Aug 27 16:38:17 2026 -0700 dependabot[bot] Bump the github-actions group across 1 directory with 5 updates (dart-lang/test#2709) 773bc56c Thu Aug 27 16:11:00 2026 -0700 Nate Bosch Use read permissions in test_descriptor and test_process workflows (dart-lang/test#2736) 73e85f1b Wed Aug 26 06:36:41 2026 +0700 herdiyanitdev Precompiled browser tests: stop serving files from outside the precompiled root (dart-lang/test#2724) bbe8f9bf Tue Aug 18 09:02:24 2026 -0700 Kevin Moore Export TestFailure from package:test_api/scaffolding.dart (dart-lang/test#2723) TAG=agy CONV=e6fd1c32-ded3-443f-83e5-2e15b4ffaccb [email protected] Change-Id: Iabc67d46c413470f0d2e5341e719d4edf702a94b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/546020 Commit-Queue: Nate Bosch <[email protected]> Auto-Submit: Nate Bosch <[email protected]> Reviewed-by: Kevin Moore <[email protected]> Commit-Queue: Kevin Moore <[email protected]>
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.
Work around, and reduce the odds of triggering, a bug in the Dart SDK
implementation of unix domain sockets on windows.
dart-lang/sdk#64166
On windows in Dart sockets are being inherited by subprocesses, so
spawned test processes (like the chrome browser) would inherit them, and
subsequently after receiving a connection the socket cancel would never
complete (waiting on subprocess which inherited the socket to exit) so
the
Stream.firstfuture would also never complete. This surfaced as adeadlock only in the case where a browser startup happens while the
socket server is waiting for the first connection.
Drastically reduce the odds of this situation by waiting to bind the
socket server until the subprocess is about to start, instead of
listening on the socket during the compilation process as well.
Work around the situation in case it still happens with a
fastFirstextension which behaves like
firstexcept it explicitly does not awaitthe Future returned from
cancel.Add an integration test which demonstrates the conditions required to
trigger the bug. We can remove this after the SDK is fixed.