Skip to content

Fake Mixers listen only on a port that can be reached - #24

Merged
Skeyelab merged 2 commits into
mainfrom
fix/fake-listener-reachable
Dec 3, 2026
Merged

Skeyelab merged 2 commits into
mainfrom
fix/fake-listener-reachable

Conversation

@Skeyelab

@Skeyelab Skeyelab commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Refs ericdahl-dev/ShowRecorder#1248

The failure

ShowRecorder run 45046780581 (Release package tests): WingLiveUpdatesLinkTests.renameReachesTheLink had no Sources after connect, 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):

Run What Result
47061003191 (Debug) 150 real FakeWings, each asked by a new WingDriver 1 of 150 deaf in each of two copies: knock answered, 0 queries heard, a second driver no better. All 20 idle clients to that fake's OSC port were waiting on EADDRINUSE with the same local port, which was another fake WING's listener port
47063345667 (Release) A listener put on the port a client just used 12 of 12 unreachable
47064371253 (Debug and Release) Same, variants Still unreachable after 5 s (6 of 6). A probe that sends nothing sees it (6 of 6). With the first listener closed, one connection gets through and the next does not (5 of 6). A client that never sent anything does not cause it (6 of 6). A listener on a fresh port is fine (24 of 24)
47065736489 (this PR's test, check switched off, #23) movesOffAnUnreachablePort fails in Debug and Release: both asks get no answer
47065748721 (this PR) movesOffAnUnreachablePort passes in Debug and Release

Why macOS chooses that local port was not established; the behavior is measured, not explained.

The fix (test code only)

  • Loopback.listen is now the one listener under FakeWing, FakeXAirMixer and FakeTextMixer. 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.
  • It carries the retry of a failed listen from Fake X-Air: a failed listen is tried again instead of waited on forever #21, so the WING and text fakes no longer wait forever on a listener that failed either.
  • A fake X-Air switched on again keeps its port, as before.
  • New test LoopbackListenTests.movesOffAnUnreachablePort asks 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

  • That every historical failure listed in #1248 was this. The old runs have no connection-state logging; the symptoms match and the same state was found on the real fakes.
  • A fake that is reachable when it starts stayed reachable in every measurement, but that was not tested exhaustively.
  • Not run locally: MixerLink needs Network.framework and this was written on Linux. macOS CI on this PR is the check.
  • ShowRecorder release/1.2 keeps its own copy of the fakes and needs the same change by hand.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ

…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

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

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
@Skeyelab
Skeyelab enabled auto-merge (squash) December 3, 2026 08:25
@Skeyelab
Skeyelab merged commit 09857b9 into main Dec 3, 2026
5 checks passed
@Skeyelab
Skeyelab deleted the fix/fake-listener-reachable branch December 3, 2026 08:27
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.

1 participant