Repository navigation
Constrain connected loopback fixture buffers - #786
MorganHo001 wants to merge 1 commit into
Conversation
|
#767 is open, redesigns the interview setup and device preparation pages, and also carries this branch's loopback fixture changes unchanged: the post-connect |
33c2f21 to
0c9161c
Compare
|
@MorganHo001 The head now has the connected-sender helper with its direct test,
Post these as replies on the threads. If a reading does not reproduce the behavior, delete that call instead of keeping it. Please also make the PR title match the commit subject (the |
0c9161c to
8f678af
Compare
|
Issue #780 reports that four LiveKit startup and handoff tests fail on macOS arm64 because the loopback fixture's small socket buffers do not produce the backpressure they assert, and its follow-up actions ask to measure and then fix the fixture. This branch bounds the connected sender after connect, reads the accepted receive limit after the WebSocket handshake, and scopes TCP_NODELAY to the startup fixture, which are the changes those tests need, but the description does not link the issue. If this branch is the fix #780 asks for, add |
|
All four tests listed in #780 pass on macOS 27.2.1 arm64 at |
8f678af to
17d2f21
Compare
17d2f21 to
625636e
Compare
The measured macOS socket replaces the requested send buffer during connect. A brief pause in small writes also fails to establish sustained pressure across macOS versions, making the startup fixtures unstable. Reapply and verify the connected sender limit. Hold a sink-owned startup audio flush explicitly for cancellation and receive-time checks without altering production writes. Keep the real large-message write-failure case and the connected-buffer regressions. Remove fixture TCP_NODELAY; the controlled flush no longer relies on packet timing. Close sysprog21#780 Change-Id: I0ef6a814f871e26e266337613364539d0208330d
625636e to
0034ed6
Compare
| writing | ||
| .try_recv() | ||
| .expect("the sink owns the paused audio write"); |
There was a problem hiding this comment.
The checkpoint is inferred from a 100 ms timer here: the frames go in at 80% of the 1 s limit, and the select! above returns at 90% whether or not the probe has consumed them. After a stall that long on a loaded runner both arms are ready, and select! polls its arms in random order, so the sleep arm can win before the probe has run. Then try_recv() finds entered unsent and panics with "the sink owns the paused audio write", or the blocked == 1 assertion below fails at 0, with the implementation correct. Awaiting the checkpoint removes the dependence: when backpressure is set, await writing under a generous safety timeout right after the frames are sent, and keep the 90% wait only for the deadline-sensitive part. The same try_recv() in startup_success_after_a_delayed_microphone_write_keeps_the_receive_time deserves a look for the same reason.
Measurements on macOS 27.2.1 (26B131) recorded SO_SNDBUF as 1024 before connect, 65328 after connect and 1024 after reapplying its limit. In the reported macOS 26.6.2 runs, small-buffer read-backs did not keep startup writes stalled. The startup ordering tests need an explicit pending-flush checkpoint instead of inferring persistent backpressure from a 100 ms pause.
Constrain and read back the connected sender, test the helper against a deliberately oversized connected buffer, and retain the end-to-end bound test. For startup ordering, hold a sink-owned audio flush at an explicit checkpoint and use three ordinary 10 ms PCM frames. These cases no longer depend on small TCP buffers or TCP_NODELAY. Keep genuine TCP handoff and large-message write-failure tests. Production networking is unchanged; deadline, receive-time, cancellation and audio-order assertions remain intact.
Validation
RUST_TEST_THREADS=1 ./scripts/test.sh rustpasses at0034ed6don macOS 27.2.1 arm64 and Ubuntu ARM64. The library suite records 2,129 passes and 19 ignored cases; the web suite records 229 passes and two ignored cases. cargo-deny was unavailable.[0, 3]after successful rescue,[0]after failed startup, and[]without audio. A controlled fault that loses frame0passes the old assertion but fails the new one; restoring the writer ordering passes. The fault is not included in the commit.A macOS 26.6.2 rerun remains outstanding. The linked review threads retain the original socket readings and Apple references; the published XNU snapshot differs from the measured kernel, so its exact mechanism remains unverified.
Close #780