Repository navigation
Fake X-Air: a failed listen is tried again instead of waited on forever - #21
Merged
Merged
Conversation
…er (ShowRecorder #1215) After a power-off the fake Mixer listens on the same port again. When a Link is still asking, that first listen often fails with EADDRINUSE, and the fake only watched for .ready, so powerOn() never returned: the power-cycle test hung and the package tests ran into the CI time limit (ShowRecorder run 43502838420). The test normally waits a timeout for the Link to notice the power-off, which hid this. When its first connect failed on a busy runner, the Link was already down, the power-on followed the power-off at once, and the listen failed. - The fake tries a failed listen again, 25 ms apart, and throws after 10 s instead of waiting forever. - The power-cycle test waits for the Link to come up after connect: a connect that fails is retried by the Link itself (#1209). - A new test power-cycles the fake at once while the Link keeps trying. Test code only. Refs ericdahl-dev/ShowRecorder#1215 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! |
Skeyelab
added a commit
that referenced
this pull request
Dec 3, 2026
* Fake Mixers listen only on a port that can be reached (ShowRecorder #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 * The probe never sees its own cancel: drop that case Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ --------- Co-authored-by: Claude Fable 5.2 <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.
Refs ericdahl-dev/ShowRecorder#1215
The hang
ShowRecorder run 43502838420 (main, Debug package tests):
MixerLinkEndToEndTests.powerCyclefailed its first expectation at 20:41:48 (no "Kick" afterconnect), no line from that test followed, and the job was canceled at its 40-minute limit.The cause is in the test's fake Mixer, not in Mixer Link:
connectfailed. The Link then keeps trying by itself (#1209).powerOff()andpowerOn(). Here the Link was already down, sopowerOn()followedpowerOff()at once.powerOn()listens on the same port again. With a Link still asking, that listen fails:failed(POSIXErrorCode(rawValue: 48): Address already in use).FakeXAirMixer.listenonly watched for.ready, so it waited forever. That is the only wait in the test with no bound.The "about 90 tests that never ended" in the issue are most likely the tail of
swift test's buffered output, lost when the job was killed; I could not confirm that from the log.Reproduced on macOS CI
On a diagnostics draft (#17, never merged), copies of this scenario with the fake listening once, as before, against the fake with this fix:
An idle fake, with no Link asking, listened again at once 20 times out of 20 (run 47051316745), which is why the test normally passes.
The fix (test code only)
FakeXAirMixer.listentries a failed listen again, 25 ms apart, and throws after 10 s instead of waiting forever. So a fake that cannot listen now fails its test, and cannot hang the run.powerCyclewaits for the Link to come up afterconnect(up to the usual bounded wait) instead of checking at once: the Link retries a failed connect by design.powerCycleAtOnce: the connect fails (the fake does not answer), the fake is switched off and on at once, and the Link comes up. Without the fake's fix this test waits forever inpowerOn().No product code changes: a real Mixer's power cycle does not involve this listener, and the Link's own retry worked in every reproduction once the fake was back.
Not verified
release/1.2keeps its own copy of the fake and the test and needs the same change by hand.🤖 Generated with Claude Code
https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ