Skip to content

Observe a connect given up on - #875

Merged
SimonCropp merged 1 commit into
mainfrom
observe-abandoned-connects
Sep 22, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
observe-abandoned-connects

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

ViewerClient.IsOwned and the synchronous TrySend wait on ConnectAsync for a bounded time, inside a using. A connect given up on is still pending when the client is disposed, and faults once that tears it down - or, where the port refuses rather than hangs, when the refusal arrives - with nobody left to observe it. The finalizer then reported it as an unobserved task exception.

That is routine rather than rare. The launch gate probes IsOwned while a viewer it has just started is still binding, and on Windows a connect to a port nothing is listening on is not refused at once, so the half second wait expires. Running ViewerLaunchTests.AcceptAllOverALongQueue printed two of them, and any test process that launches the viewer gets the same, fatally in a host that treats unobserved task exceptions as fatal.

Both sites now connect through one helper, which observes the abandoned task with a continuation. The timeouts, and what Found records, are unchanged.

AConnectGivenUpOnIsObserved gives up on five connects with a zero wait, which abandons them whatever the platform does with a closed port, then collects and asserts nothing was reported. It fails on the old code on net10 and net48.

ViewerClient.IsOwned and the synchronous TrySend wait on ConnectAsync
for a bounded time, inside a using. A connect given up on is still
pending when the client is disposed, and faults once that tears it
down - or, where the port refuses rather than hangs, when the refusal
arrives - with nobody left to observe it. The finalizer then reported
it as an unobserved task exception.

That is routine rather than rare. The launch gate probes IsOwned while
a viewer it has just started is still binding, and on Windows a connect
to a port nothing is listening on is not refused at once, so the half
second wait expires. Running ViewerLaunchTests.AcceptAllOverALongQueue
printed two of them, and any test process that launches the viewer
gets the same, fatally in a host that treats unobserved task exceptions
as fatal.

Both sites now connect through one helper, which observes the abandoned
task with a continuation. The timeouts, and what Found records, are
unchanged.

AConnectGivenUpOnIsObserved gives up on five connects with a zero wait,
which abandons them whatever the platform does with a closed port,
then collects and asserts nothing was reported. It fails on the old
code on net10 and net48.
@SimonCropp SimonCropp added this to the 20.4.0 milestone Sep 22, 2026
@SimonCropp
SimonCropp merged commit 4321e0d into main Sep 22, 2026
10 checks passed
@SimonCropp
SimonCropp deleted the observe-abandoned-connects branch September 22, 2026 06:12
This was referenced Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant