Repository navigation
Fake Mixers listen only on a port that can be reached - #24
Merged
Merged
Conversation
…1248) macOS can hand a new loopback listener a port that a client used a moment ago to talk to another listener in the same process. Every new connection to such a port then waits on EADDRINUSE, so a fake Mixer there never hears its driver: the WING answered its knock and never heard a query, and the Link stayed down for as long as the test waited. - Loopback.listen is now the one listener under FakeWing, FakeXAirMixer and FakeTextMixer. It checks that two new connections get through to the port and takes another port when they don't. - It also carries the retry of a failed listen from #21, so the WING and text fakes get that too. - A new test asks a listener onto a port a client just used. Test code only. Refs ericdahl-dev/ShowRecorder#1248 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ
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.
Refs ericdahl-dev/ShowRecorder#1248
The failure
ShowRecorder run 45046780581 (Release package tests):
WingLiveUpdatesLinkTests.renameReachesTheLinkhad no Sources afterconnect, and then the Link, retrying every 100 ms with a 10 s timeout, still had none 141 s later on a process that was otherwise idle. The same shape shows in other runs (46911349827, 46182844606 and more, listed in the issue): the fake WING answers its knock on one port and never hears a query on the other.Cause: a fake Mixer on a port nothing can reach
Each fake listens on a port macOS picks. macOS can pick a port that a client in this process used a moment ago to talk to another fake. Every new connection to that port then gets the other fake's port as its own local port and sits in
waiting(POSIXErrorCode(rawValue: 48): Address already in use). Nothing arrives at the fake, however long the Link retries.Measured on macOS CI (diagnostics drafts #17, #22 and #23, none merged):
FakeWings, each asked by a newWingDrivermovesOffAnUnreachablePortmovesOffAnUnreachablePortWhy macOS chooses that local port was not established; the behavior is measured, not explained.
The fix (test code only)
Loopback.listenis now the one listener underFakeWing,FakeXAirMixerandFakeTextMixer. When its listener is ready it opens two connections to the port, sending nothing, and waits for their state. If either cannot get through, it takes another port. So a fake reports its port only once the port can be reached.LoopbackListenTests.movesOffAnUnreachablePortasks a listener onto a port a client just used.No product code changes. The condition needs a UDP listener and its client in one process on one host, which is the test setup; the app only ever is the client of a Mixer on another machine. That part is reasoning, not a measurement.
Not verified
release/1.2keeps its own copy of the fakes and needs the same change by hand.🤖 Generated with Claude Code
https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ