tests: stop room tests hanging on macOS - #6857
Open
longcw wants to merge 2 commits into
Open
Conversation
test_room.py is marked concurrent, so its nine tests open every room at once. On macOS the native layer never completes Room.connect when the file descriptor soft limit is large, and the whole --unit run hangs. Cap the soft limit at 8192 in pytest_configure, lowering it only, and wrap Room.connect in asyncio.wait_for so a wedged connection fails with a test name attached.
The timeout raised before the try block, so the room was never disconnected and its FFI handle, event tasks and socket stayed alive for the rest of the shared-loop concurrent group. Move the connect inside the try whose finally disconnects, and reuse that helper in _test_wait_disconnect instead of repeating the connect.
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.
Problem
tests/test_room.pyis markedconcurrent, so its nine tests open every room at the same time. When the file descriptor soft limit is large, the native layer on macOS never completesRoom.connectandpytest --unithangs forever. Nothing boundsRoom.connect, and per-item timeouts do not arm inside a concurrent group, so the run stops with no test name.Fix
pytest_configurenow caps the file descriptor soft limit at 8192 on macOS, and only ever lowers it, so a machine already below that value is unaffected.Room.connectnow runs underasyncio.wait_for, so a wedged connection fails in 15 seconds with a test name. Linux is untouched, so CI behavior does not change.The 8192 value is measured on one macOS machine: 8192 passes on three trials, 12288 and above deadlock, and 1024 and below fail on descriptor exhaustion.