Skip to content

Fix Connection reset by peer in protocol error tests #1786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 2, 2025

Conversation

brianquinlan
Copy link
Collaborator

@brianquinlan brianquinlan commented Jul 1, 2025

Fixes this exception, which is sometimes thrown when the client disconnects:

SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 54), address = localhost, port = 49524
dart:async/future_impl.dart 21:26                                                                                      _interceptError
dart:async/future_impl.dart 52:23                                                                                      _interceptUserError
dart:async/stream_controller.dart 624:39                                                                               _StreamController.addError
dart:io-patch/socket_patch.dart 2339:21                                                                                new _RawSocket.<fn>
package:stack_trace/src/stack_zone_specification.dart 138:43                                                           StackZoneSpecification._registerBinaryCallback.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 207:15                                                           StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 138:31                                                           StackZoneSpecification._registerBinaryCallback.<fn>
dart:async/zone.dart 1568:13                                                                                           _rootRunBinary
dart:async/zone.dart 1436:19                                                                                           _CustomZone.runBinary
dart:async/zone.dart 1337:7                                                                                            _CustomZone.runBinaryGuarded
dart:async/zone.dart 1374:33                                                                                           _CustomZone.bindBinaryCallbackGuarded.<fn>
dart:io-patch/socket_patch.dart 1938:14                                                                                _NativeSocket.reportError
dart:io-patch/socket_patch.dart 1733:17                                                                                _NativeSocket.multiplex
dart:isolate-patch/isolate_patch.dart 193:12                                                                           _RawReceivePort._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1459:19                                                                                           _CustomZone.registerBinaryCallback
dart:async/zone.dart 1373:22                                                                                           _CustomZone.bindBinaryCallbackGuarded
dart:io-patch/socket_patch.dart 2338:19                                                                                new _RawSocket
dart:io-patch/socket_patch.dart 2196:26                                                                                _RawServerSocket.listen.<fn>
package:stack_trace/src/stack_zone_specification.dart 207:15                                                           StackZoneSpecification._run
dart:async/stream_controller.dart 798:19                                                                               _SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 663:7                                                                                _StreamController._add
dart:async/stream_controller.dart 618:5                                                                                _StreamController.add
dart:async/zone.dart 1546:13                                                                                           _rootRunUnary
dart:async/zone.dart 1429:19                                                                                           _CustomZone.runUnary
dart:async/zone.dart 1329:7                                                                                            _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 381:11                                                                                     _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 312:7                                                                                      _BufferingStreamSubscription._add
dart:async/stream_controller.dart 798:19                                                                               _SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 663:7                                                                                _StreamController._add
dart:async/stream_controller.dart 618:5                                                                                _StreamController.add
dart:async/stream_controller.dart 898:13                                                                               _StreamSinkWrapper.add
package:stream_channel/src/guarantee_channel.dart 125:12                                                               _GuaranteeSink.add
package:stream_channel/src/multi_channel.dart 159:31                                                                   new _MultiChannel.<fn>
dart:async/zone.dart 1778:10                                                                                           _RootZone.runUnaryGuarded
dart:_internal/async_cast.dart 96:11                                                                                   CastStreamSubscription._onData
dart:async/zone.dart 1778:10                                                                                           _RootZone.runUnaryGuarded
dart:async/stream_impl.dart 381:11                                                                                     _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 312:7                                                                                      _BufferingStreamSubscription._add
dart:async/stream_controller.dart 798:19                                                                               _SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 663:7                                                                                _StreamController._add
dart:async/stream_controller.dart 618:5                                                                                _StreamController.add
dart:async/zone.dart 1778:10                                                                                           _RootZone.runUnaryGuarded
dart:async/stream_impl.dart 381:11                                                                                     _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 312:7                                                                                      _BufferingStreamSubscription._add
dart:async/stream_controller.dart 798:19                                                                               _SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 663:7                                                                                _StreamController._add
dart:async/stream_controller.dart 618:5                                                                                _StreamController.add
dart:async/stream_controller.dart 898:13                                                                               _StreamSinkWrapper.add
package:stream_channel/src/guarantee_channel.dart 125:12                                                               _GuaranteeSink.add
var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/flutter_tools.XWlnm3/flutter_test_listener.5o7DFC/listener.dart 56:22  main.<fn>
dart:async/zone.dart 1854:54                                                                                           _RootZone.runBinary
dart:async/zone.dart 1810:33                                                                                           _RootZone.bindBinaryCallback.<fn>
dart:developer-patch/developer.dart 111:23                                                                             _runExtension

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

```
  SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 54), address = localhost, port = 49332
  dart:_http                                                                                                              _HttpServer.listen
  package:web_socket_conformance_tests/src/peer_protocol_errors_server.dart 18:7                                          hybridMain
  ===== asynchronous gap ===========================
  dart:async                                                                                                              _CustomZone.registerUnaryCallback
  package:web_socket_conformance_tests/src/peer_protocol_errors_server.dart 17:13                                         hybridMain
  package:web_socket_conformance_tests/src/peer_protocol_errors_server_vm.dart 10:3                                       startServer
  package:web_socket_conformance_tests/src/peer_protocol_errors_tests.dart 23:33                                          testPeerProtocolErrors.<fn>.<fn>
  ===== asynchronous gap ===========================
  package:stream_channel                                                                                                  _GuaranteeSink.add
  /var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/flutter_tools.M74xpu/flutter_test_listener.SLapVu/listener.dart 53:22  main.<fn>
```
Copy link

github-actions bot commented Jul 1, 2025

Package publishing

Package Version Status Publish tag (post-merge)
package:cronet_http 1.4.0-wip WIP (no publish necessary)
package:cupertino_http 2.2.0 already published at pub.dev
package:http 1.4.1-wip (error) pubspec version (1.4.1-wip) and changelog (1.4.1) don't agree
package:http2 3.0.0 ready to publish http2-v3.0.0
package:http_multi_server 3.2.2 already published at pub.dev
package:http_parser 4.1.2 already published at pub.dev
package:http_profile 0.1.1-wip WIP (no publish necessary)
package:ok_http 0.1.1-wip WIP (no publish necessary)
package:web_socket 1.0.1 already published at pub.dev
package:web_socket_channel 3.0.3 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

Copy link

github-actions bot commented Jul 1, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ✔️
File Coverage

This check for test coverage is informational (issues shown here will not fail the PR).

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/http/example/main.dart

@github-actions github-actions bot added the type-infra A repository infrastructure change or enhancement label Jul 1, 2025
Copy link

@liamappelbe liamappelbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Does this need a changelog entry?


}, (e, s) {
// dart:io sometimes asynchronously throws a `SocketException` with
//`errorCode` 54.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uber nit: missing space after //.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@brianquinlan
Copy link
Collaborator Author

LGTM. Does this need a changelog entry?

We don't release this package.

@brianquinlan brianquinlan merged commit 7d2d87e into dart-lang:master Jul 2, 2025
42 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 8, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/64dfa7f..9b007b3):
  9b007b3  2025-07-07  Jacob MacDonald  Add failure reasons to tool call analytics events (dart-lang/ai#219)
  c8dc5da  2025-07-07  Jacob MacDonald  don't bail early when running in multiple roots (dart-lang/ai#218)
  2541b6c  2025-07-02  Kenzie Davisson  Remove VS Code mcp instructions in favor of Dart-Code setting. (dart-lang/ai#206)
  70daa1f  2025-07-02  Jacob MacDonald  release dart_mcp 0.3.0 (dart-lang/ai#216)
  a252a46  2025-07-01  Jacob MacDonald  add retry logic to try and make dtd_test less flaky (dart-lang/ai#214)
  9e0b973  2025-07-01  Jacob MacDonald  add a test that the arg parser library only depends on package:args (dart-lang/ai#213)

http (https://github.com/dart-lang/http/compare/e70a41b..7d2d87e):
  7d2d87e  2025-07-02  Brian Quinlan  Fix `Connection reset by peer` in protocol error tests (dart-lang/http#1786)

i18n (https://github.com/dart-lang/i18n/compare/ab90327..42c4932):
  42c49328  2025-07-07  Googler  No public description
  87fd0156  2025-07-07  Michael Goderbauer  [intl4x] Re-enable Windows (dart-lang/i18n#986)
  912a7720  2025-07-07  Copybara-Service  Merge pull request `#985` from dart-lang:fixConstantEvaluator
  52f5beeb  2025-07-07  Moritz  Small cleanups in intl4x (dart-lang/i18n#988)
  6e8ef245  2025-07-07  Moritz  squash

sync_http (https://github.com/dart-lang/sync_http/compare/dc54465..c07f96f):
  c07f96f  2025-07-03  Kevin Moore  Update to latest lints, required Dart 3.7 (google/sync_http.dart#55)

tools (https://github.com/dart-lang/tools/compare/7bf22c9..6282b35):
  6282b35e  2025-07-03  Lasse R.H. Nielsen  [Markdown] Fix HTML comment parser. (dart-lang/tools#2121)

web (https://github.com/dart-lang/web/compare/3e11172..fb8a149):
  fb8a149  2025-07-07  Nikechukwu  Add Support for Configuration of Dart JS Interop Gen (dart-lang/web#386)

Change-Id: Ib243021ed77846a8451f60fa320e5cf40e85aa27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439320
Commit-Queue: Konstantin Shcheglov <[email protected]>
Auto-Submit: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-infra A repository infrastructure change or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants