Skip to content

Accept relay connection reset when waiting for stalled Blazor WASM bridge close - #21963

Merged
Ella Hathaway (ellahathaway) merged 1 commit into
mainfrom
aspireagent/fix-21791-blazor-relay-stalled-bridge-econnreset
Nov 9, 2026
Merged

Ella Hathaway (ellahathaway) merged 1 commit into
mainfrom
aspireagent/fix-21791-blazor-relay-stalled-bridge-econnreset

Conversation

@davidfowl

Copy link
Copy Markdown
Collaborator

The VS Code extension unit test Blazor WASM debug relay closes a stalled bridge upgrade at the … launch deadline failed on Windows with Error: read ECONNRESET at TCP.onStreamRead (41953320272, 41969207688, 41509624265). The relay behaves correctly: when the launch deadline expires it aborts the stalled ws opening, which destroys its upstream socket. On Windows, the test bridge's end of that socket can see the abort as a TCP reset, so it emits error (ECONNRESET) before close. The test waited with events.once(socket, 'close'), and events.once rejects when the emitter emits error, so the test failed even though the connection was closed as intended. The test bridge now records errors on each upgrade socket and exposes closed(), which waits only for close and then asserts that any error was ECONNRESET. Both launch-deadline tests and the related disposal test, which used the same wait, now use it. The existing pre-deadline OPEN, CLOSED and destroyed assertions are unchanged. This change only touches tests; production behavior is the same.

Fixes #21791

Confidence

High. I reproduced the CI failure on Linux by temporarily making the relay reset its upstream socket (resetAndDestroy()) instead of closing it normally:

  • Old test: both deadline tests fail with the same Error: read ECONNRESET seen in CI.
  • New test: all 35 relay tests pass.

With the unmodified relay, all 35 tests pass in 3 consecutive runs, and compile-tests, webpack and eslint pass. Main uncertainty: I haven't run the tests on Windows locally; the extension-unit (Windows) CI job on this PR covers that.

How we stop this recurring: tests that wait for a peer socket to close after the relay aborts it should wait for close and handle error separately. They shouldn't use events.once(socket, 'close'), which turns an expected connection reset into a test failure.

Failure stats (14d, attempt 1)

Scope Jobs Failures of this test Rate
main, Tests / Run VS Code extension unit tests (Windows), first attempt, 2026-10-26 to 2026-11-09 153 completed 3 (2026-11-02, 2026-11-05 ×2) ~2.0%

The other 3 failures of this job in the window came from unrelated tests: 2 in E2E storage diagnostics and 1 elsewhere. I couldn't read job data for 6 runs. All 3 hits have the same signature: read ECONNRESET at TCP.onStreamRead, in either the default or the 3000 ms deadline variant.

Verdict: STRONG. The same signature appeared in 3 independent runs, and the failure reproduces deterministically when the relay's abort is forced to a TCP reset.

🤖 Posted by AspireAgent (AI Agent)

The relay aborts an unusable upstream WebSocket opening by destroying its
socket. On Windows the test bridge can observe that as ECONNRESET before
'close', and events.once(socket, 'close') rejects on the error event even
though the relay behaved correctly. Record bridge upgrade socket errors and
wait only for 'close', asserting any error is ECONNRESET.

Fixes #21791

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl David Fowler (davidfowl) added flaky-test area-vscode-extension ci-health Fixes CI flakiness or CI infrastructure (AspireAgent queue) agent:working An AI agent is actively working on this issue or PR labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21963

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21963"

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 9, 2026 14:20
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Tests selector

0 / 101 PR test projects · 2 PR jobs, from 1 changed file.

Selected PR test projects (0 / 101)

none — no PR-gated .NET test projects run for this change.

Selected PR jobs (2)

extension-e2e, extension-unit


How these were chosen — grouped by what changed

Job reasons

Job Triggered by
extension-e2e extension/src/test/blazorWasmDebugRelay.test.ts
extension-unit extension/src/test/blazorWasmDebugRelay.test.ts

Selection computed for commit e97ae62.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the test-only change to handle expected connection resets.

No open issues 🎉

What changed in this PR

This test-only change addresses Windows connection-reset failures in the VS Code extension’s Blazor WASM debug relay tests. Production behavior is unchanged.

Changes:

  • Record upgrade socket errors and add a closed() helper that waits for closure while accepting only ECONNRESET errors.
  • Use the helper in both launch-deadline tests and the disposal test, preserving existing state assertions.
File Description
extension/​src/​test/​blazorWasmDebugRelay.test.ts Handle expected connection resets when waiting for stalled bridge sockets to close.

Review effort: Balanced

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review November 9, 2026 14:50
@davidfowl David Fowler (davidfowl) removed the agent:working An AI agent is actively working on this issue or PR label Nov 9, 2026
@ellahathaway
Ella Hathaway (ellahathaway) merged commit e4763e1 into main Nov 9, 2026
110 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.1 milestone Nov 9, 2026
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
…idge close (#21963)

The VS Code extension unit test `Blazor WASM debug relay closes a
stalled bridge upgrade at the … launch deadline` failed on Windows with
`Error: read ECONNRESET at TCP.onStreamRead`
([41953320272](https://github.com/microsoft/aspire/actions/runs/41953320272),
[41969207688](https://github.com/microsoft/aspire/actions/runs/41969207688),
[41509624265](https://github.com/microsoft/aspire/actions/runs/41509624265)).
The relay behaves correctly: when the launch deadline expires it aborts
the stalled `ws` opening, which destroys its upstream socket. On
Windows, the test bridge's end of that socket can see the abort as a TCP
reset, so it emits `error` (ECONNRESET) before `close`. The test waited
with `events.once(socket, 'close')`, and `events.once` rejects when the
emitter emits `error`, so the test failed even though the connection was
closed as intended. The test bridge now records errors on each upgrade
socket and exposes `closed()`, which waits only for `close` and then
asserts that any error was `ECONNRESET`. Both launch-deadline tests and
the related disposal test, which used the same wait, now use it. The
existing pre-deadline `OPEN`, `CLOSED` and `destroyed` assertions are
unchanged. This change only touches tests; production behavior is the
same.

Fixes #21791

## Confidence

High. I reproduced the CI failure on Linux by temporarily making the
relay reset its upstream socket (`resetAndDestroy()`) instead of closing
it normally:
- Old test: both deadline tests fail with the same `Error: read
ECONNRESET` seen in CI.
- New test: all 35 relay tests pass.

With the unmodified relay, all 35 tests pass in 3 consecutive runs, and
`compile-tests`, `webpack` and `eslint` pass. Main uncertainty: I
haven't run the tests on Windows locally; the extension-unit (Windows)
CI job on this PR covers that.

How we stop this recurring: tests that wait for a peer socket to close
after the relay aborts it should wait for `close` and handle `error`
separately. They shouldn't use `events.once(socket, 'close')`, which
turns an expected connection reset into a test failure.

## Failure stats (14d, attempt 1)

| Scope | Jobs | Failures of this test | Rate |
|---|---|---|---|
| `main`, Tests / Run VS Code extension unit tests (Windows), first
attempt, 2026-10-26 to 2026-11-09 | 153 completed | 3 (2026-11-02,
2026-11-05 ×2) | ~2.0% |

The other 3 failures of this job in the window came from unrelated
tests: 2 in E2E storage diagnostics and 1 elsewhere. I couldn't read job
data for 6 runs. All 3 hits have the same signature: `read ECONNRESET`
at `TCP.onStreamRead`, in either the default or the 3000 ms deadline
variant.

**Verdict: STRONG.** The same signature appeared in 3 independent runs,
and the failure reproduces deterministically when the relay's abort is
forced to a TCP reset.

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit e4763e1)
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
…idge close (#21963)

The VS Code extension unit test `Blazor WASM debug relay closes a
stalled bridge upgrade at the … launch deadline` failed on Windows with
`Error: read ECONNRESET at TCP.onStreamRead`
([41953320272](https://github.com/microsoft/aspire/actions/runs/41953320272),
[41969207688](https://github.com/microsoft/aspire/actions/runs/41969207688),
[41509624265](https://github.com/microsoft/aspire/actions/runs/41509624265)).
The relay behaves correctly: when the launch deadline expires it aborts
the stalled `ws` opening, which destroys its upstream socket. On
Windows, the test bridge's end of that socket can see the abort as a TCP
reset, so it emits `error` (ECONNRESET) before `close`. The test waited
with `events.once(socket, 'close')`, and `events.once` rejects when the
emitter emits `error`, so the test failed even though the connection was
closed as intended. The test bridge now records errors on each upgrade
socket and exposes `closed()`, which waits only for `close` and then
asserts that any error was `ECONNRESET`. Both launch-deadline tests and
the related disposal test, which used the same wait, now use it. The
existing pre-deadline `OPEN`, `CLOSED` and `destroyed` assertions are
unchanged. This change only touches tests; production behavior is the
same.

Fixes #21791

## Confidence

High. I reproduced the CI failure on Linux by temporarily making the
relay reset its upstream socket (`resetAndDestroy()`) instead of closing
it normally:
- Old test: both deadline tests fail with the same `Error: read
ECONNRESET` seen in CI.
- New test: all 35 relay tests pass.

With the unmodified relay, all 35 tests pass in 3 consecutive runs, and
`compile-tests`, `webpack` and `eslint` pass. Main uncertainty: I
haven't run the tests on Windows locally; the extension-unit (Windows)
CI job on this PR covers that.

How we stop this recurring: tests that wait for a peer socket to close
after the relay aborts it should wait for `close` and handle `error`
separately. They shouldn't use `events.once(socket, 'close')`, which
turns an expected connection reset into a test failure.

## Failure stats (14d, attempt 1)

| Scope | Jobs | Failures of this test | Rate |
|---|---|---|---|
| `main`, Tests / Run VS Code extension unit tests (Windows), first
attempt, 2026-10-26 to 2026-11-09 | 153 completed | 3 (2026-11-02,
2026-11-05 ×2) | ~2.0% |

The other 3 failures of this job in the window came from unrelated
tests: 2 in E2E storage diagnostics and 1 elsewhere. I couldn't read job
data for 6 runs. All 3 hits have the same signature: `read ECONNRESET`
at `TCP.onStreamRead`, in either the default or the 3000 ms deadline
variant.

**Verdict: STRONG.** The same signature appeared in 3 independent runs,
and the failure reproduces deterministically when the relay's abort is
forced to a TCP reset.

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit e4763e1)
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
…idge close (#21963)

The VS Code extension unit test `Blazor WASM debug relay closes a
stalled bridge upgrade at the … launch deadline` failed on Windows with
`Error: read ECONNRESET at TCP.onStreamRead`
([41953320272](https://github.com/microsoft/aspire/actions/runs/41953320272),
[41969207688](https://github.com/microsoft/aspire/actions/runs/41969207688),
[41509624265](https://github.com/microsoft/aspire/actions/runs/41509624265)).
The relay behaves correctly: when the launch deadline expires it aborts
the stalled `ws` opening, which destroys its upstream socket. On
Windows, the test bridge's end of that socket can see the abort as a TCP
reset, so it emits `error` (ECONNRESET) before `close`. The test waited
with `events.once(socket, 'close')`, and `events.once` rejects when the
emitter emits `error`, so the test failed even though the connection was
closed as intended. The test bridge now records errors on each upgrade
socket and exposes `closed()`, which waits only for `close` and then
asserts that any error was `ECONNRESET`. Both launch-deadline tests and
the related disposal test, which used the same wait, now use it. The
existing pre-deadline `OPEN`, `CLOSED` and `destroyed` assertions are
unchanged. This change only touches tests; production behavior is the
same.

Fixes #21791

## Confidence

High. I reproduced the CI failure on Linux by temporarily making the
relay reset its upstream socket (`resetAndDestroy()`) instead of closing
it normally:
- Old test: both deadline tests fail with the same `Error: read
ECONNRESET` seen in CI.
- New test: all 35 relay tests pass.

With the unmodified relay, all 35 tests pass in 3 consecutive runs, and
`compile-tests`, `webpack` and `eslint` pass. Main uncertainty: I
haven't run the tests on Windows locally; the extension-unit (Windows)
CI job on this PR covers that.

How we stop this recurring: tests that wait for a peer socket to close
after the relay aborts it should wait for `close` and handle `error`
separately. They shouldn't use `events.once(socket, 'close')`, which
turns an expected connection reset into a test failure.

## Failure stats (14d, attempt 1)

| Scope | Jobs | Failures of this test | Rate |
|---|---|---|---|
| `main`, Tests / Run VS Code extension unit tests (Windows), first
attempt, 2026-10-26 to 2026-11-09 | 153 completed | 3 (2026-11-02,
2026-11-05 ×2) | ~2.0% |

The other 3 failures of this job in the window came from unrelated
tests: 2 in E2E storage diagnostics and 1 elsewhere. I couldn't read job
data for 6 runs. All 3 hits have the same signature: `read ECONNRESET`
at `TCP.onStreamRead`, in either the default or the 3000 ms deadline
variant.

**Verdict: STRONG.** The same signature appeared in 3 independent runs,
and the failure reproduces deterministically when the relay's abort is
forced to a TCP reset.

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit e4763e1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-vscode-extension ci-health Fixes CI flakiness or CI infrastructure (AspireAgent queue) flaky-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI Failure] VS Code extension unit tests on Windows fail with transient ECONNRESET in Blazor WASM debug relay stalled bridge test

3 participants