Skip to content

[infra] Flaky Windows CI failure in dart test --coverage ("Connection closed before full header was received") #3738

Open

Description

@dcharkes

On the build (windows, dev) bot, dart test --coverage=./coverage flakily fails to load a random test suite with a VM service WebSocket error:

Failed to load "<test_file>.dart": Connection closed before full header was received, uri = http://127.0.0.1:<port>/<token>=/ws

Pointers to failures

Root cause notes

  1. WebSocket connection failure during suite loading:
    In package:test_core (lib/src/runner/vm/platform.dart), Configuration.debug is true whenever --coverage is passed. In VMPlatform._loadSuite, test_core calls vmServiceConnectUri(serviceWebsocket.toString()) for every test suite it loads (and package:coverage's collect() opens another WebSocket connection when each suite completes). Across ~200+ test suites running in a single dart test --coverage=./coverage invocation on Windows, the local VM service server (127.0.0.1:<port>) occasionally drops a WebSocket handshake with HttpException: Connection closed before full header was received.
  2. 6-hour hang on test_core <= 0.6.20 (fixed in test_core 0.6.21):
    In test_core 0.6.20 (used in the three runs that timed out after 6 hours), VMPlatform.load only registered isolate.kill and receivePort.close to run when channel closed after a suite finished. When vmServiceConnectUri threw during load, the already-spawned test isolate and ReceivePort were never cleaned up, preventing the dart test process from exiting after all tests finished. test_core 0.6.21 wraps _loadSuite in a try/catch that runs cleanupCallbacks on load failure, so the process now exits with code 1 instead of hanging for 6 hours, though the underlying vmServiceConnectUri flake under --coverage remains.

Activity

  1. added
    type-infraA repository infrastructure change or enhancement
    on Oct 12, 2026
  2. dcharkes commented on Oct 12, 2026

    @dcharkes
    CollaboratorAuthor
  3. dcharkes commented on Oct 12, 2026

    @dcharkes
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-infraA repository infrastructure change or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions