Repository navigation
Stop SyntheticPeer teardown from failing skipped tests - #45
Merged
Merged
Conversation
…Windows Transmission skip
SyntheticPeer's accept loop checks _stopping, then calls AcceptTcpClientAsync.
If DisposeAsync cancels and stops the listener between the two, TcpListener
throws InvalidOperationException ("Not listening") before it looks at the
token, and the catch filter did not cover it. DisposeAsync then rethrew it,
and from an `await using` that replaces the test's own outcome: a libtorrent
oracle test that skips straight after starting two peers was reported as
failed, and failed the 5.4.1 release run on Ubuntu. The loop now treats that
exception as shutdown when _stopping is already cancelled, which DisposeAsync
does before it stops the listener.
No regression test: start-and-dispose stress over 1,280 peers did not hit the
window, which needs the loop to pass its check and dispose to run before the
very next call. A deterministic test would need a hook inside the loop.
Also brings the docs up to date with the release gate change in #44:
tests/README.md says that leeching from Transmission skips on Windows and how
to opt back in, and the 5.4.1 changelog says that downloading from
Transmission is checked on Linux only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the failure in the latest 5.4.1 release run (Ubuntu interop) and brings the docs up to date with #44.
The failure
LibtorrentAlsoDialsAPeerIntroducedOnlyBySyntheticPexfailed in 41 ms withInvalidOperationException: Not listening, when it should have been skipped (PEERSHARP_INTEROPisn't set in that job).The test starts two
SyntheticPeers and then skips.await usingdisposes them a few milliseconds later.SyntheticPeer's accept loop checks_stopping, then callsAcceptTcpClientAsync. IfDisposeAsynccancels and stops the listener between those two steps,TcpListenerthrows "Not listening" before it looks at the token, and the loop's catch filter didn't cover that.DisposeAsyncthen rethrew it, and an exception fromawait usingreplaces the test's own outcome, so the skip became a failure.Changes
SyntheticPeer: the accept loop treatsInvalidOperationExceptionas shutdown when_stoppingis already cancelled.DisposeAsynccancels_stoppingbefore stopping the listener, so that ordering always holds during shutdown. The same exception at any other time still surfaces.tests/README.md: notes thatLeeching_FromTransmission_ReceivesTheWholeFileskips on Windows unlessPEERSHARP_TRANSMISSION_LEECH_ON_WINDOWS=1, and why. This was missing from Skip leeching from Transmission on Windows in the release gate #44.CHANGELOG.md(5.4.1, Testing): says that downloading from Transmission is checked on Linux only. The library itself is unchanged, so the package notes and the main README stay as they are.Validation
dotnet format --verify-no-changesis clean, and the Release build with warnings as errors succeeds.SyntheticPeerpass, and the libtorrent oracle tests skip cleanly.After merging
5.4.1 is still unpublished. Run the Release workflow on
mainagain rather than re-running the old run's failed job, so the tagged commit includes these docs.🤖 Generated with Claude Code