Skip to content

[release/17.0] Accept relay connection reset when waiting for stalled Blazor WASM bridge close - #22030

Closed
Mitch Denny (mitchdenny) wants to merge 1 commit into
mitchdenny-backport-17-0-32-pr20178from
mitchdenny-backport-17-0-33-pr21963
Closed

Mitch Denny (mitchdenny) wants to merge 1 commit into
mitchdenny-backport-17-0-32-pr20178from
mitchdenny-backport-17-0-33-pr21963

Conversation

@mitchdenny

Copy link
Copy Markdown
Member

Description

Backport of #21963 to release/17.0 (cherry-picked from e4763e1 with no modifications). Layer 33 of 55 in the release/17.0 backport stack; stacked on #22029.

Backport recommendation: No — Extension test flake.

Validation: Stable patch IDs match the original commit. Builds/tests not run for this unchanged cherry-pick.

Backport of #21963

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

…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)
@github-actions

This comment has been minimized.

@mitchdenny
Mitch Denny (mitchdenny) force-pushed the mitchdenny-backport-17-0-33-pr21963 branch 2 times, most recently from 8c12e08 to 91a79a9 Compare November 10, 2026 04:24
@github-actions

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 -- 22030

Or

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

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@mitchdenny

Copy link
Copy Markdown
Member Author

Approved for inclusion in release/17.0. Do not merge yet.

@github-actions

This comment has been minimized.

@mitchdenny
Mitch Denny (mitchdenny) force-pushed the mitchdenny-backport-17-0-33-pr21963 branch 2 times, most recently from 91a79a9 to 8d41852 Compare November 10, 2026 07:41
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants