Repository navigation
Fix the macOS test hang: send every byte of virtual masks and XY arrays - #60
Merged
CSSFrancis merged 2 commits intoSep 24, 2026
Merged
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…n connection socket.send may accept only part of a buffer, and does on macOS's loopback once the socket has a timeout. __sendToSocket ignored the count (and skipped a chunk on timeout), so the server waited for mask bytes that never came. The fake server then went back to accept() with the connection still open, so every later command hung: one lost chunk became 60 s per remaining test until the job hit its 20-minute limit. - __sendToSocket uses sendall; set_xy_array and set_virtual_mask send their command packets with sendall too - the simulated server closes a connection after an error - close_port stops only deapi's simulated server; a real DE-Server on port 13240 ends the run with a message instead of being terminated - tests: a socket that sends at most 1000 bytes per call reproduces the hang on any OS
Without a scan it is one frame, 1 ms at 1000 fps, and could finish before the test read acquiring (the other macOS py3.12 failure).
CSSFrancis
force-pushed
the
fix/socket-partial-sends
branch
from
September 24, 2026 21:29
7d27745 to
d3cb5e2
Compare
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 macOS CI hang:
macos-latest-py3.12sometimes stalls intest_client.py, then times out every remaining test until the job reaches its 20-minute limit.Cause
Client.__sendToSocketcould drop data. It sent virtual masks and XY scan arrays in 4096-byte chunks withsock.send(chunk)and ignored the return value. Once a socket has a timeout,sendcan accept only part of a chunk. macOS's loopback does this regularly. The unsent bytes were dropped, and after a send timeout the loop also skipped the rest of that chunk. The server then waited for mask bytes that never arrived.accept()without closing the connection. The session-wide test client sent every later command into that dead connection, and each test waited out--timeout=60.In CI this showed up as a hang at
test_set_virtual_mask, which sends a 1 MB mask.Changes
__sendToSocketusessendall, with the same timeout as before. The command packets inset_virtual_maskandset_xy_arrayalso usesendall, like the other commands.close_portnow stops only deapi's own simulated server. Before, running the tests on a machine with DE-Server listening on 13240 terminated DE-Server. Now the run stops with a message instead.Tests
test_fake_server/test_partial_sends.py: wraps the client's socket sosendaccepts at most 1000 bytes per call, which reproduces the hang on any OS. It covers a virtual mask round trip (followed by one more command, to check the connection is still usable) and the shared send helper over a socket pair.--timeout=60, gives 51 passed and 128 skipped.Also fixed
test_start_acquisition_scan_disabledalso failed intermittently on macOS, and the hang used to hide it. With scan off the fake acquisition is one frame, which takes 1 ms at the suite's 1000 fps. It could finish before the test readacquiring. The test now runs at 2 fps, so the acquisition lasts 0.5 s.