Raise the file descriptor limit for descriptor-heavy tests - #3060
Merged
Conversation
test_event opens 256 UDP receivers plus a sender on top of the loop's own descriptors. macOS starts processes with a soft RLIMIT_NOFILE of 256, so socket() eventually returned -1 and the unchecked descriptor tripped the bind() assertion when running ctest from a stock terminal (#3058). Wrap every registered unit test in a small sh launcher that raises the soft limit to 1024 before exec'ing the binary, and have test_event raise its own limit as well so it also passes when run directly. Assert on socket() failures so a limit problem is reported as such instead of as a bind error. Fixes #3058 Claude-Session: https://claude.ai/code/session_01PSG4XV3jiqitDgdgFSGATx
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.
Summary
test_eventopens 256 UDP receivers plus a sender, and macOS starts processes with a softRLIMIT_NOFILEof 256, sosocket()eventually failed and the unchecked descriptor tripped thebind()assertion (cmake build test error on macOS #3058).sh -c 'ulimit -n 1024 2>/dev/null; exec ...'launcher on non-Windows so the harness raises the soft limit before running each test. A failedulimitis ignored so tests still run on hosts with a lower hard limit.test_raise_fd_limit()totest_helpers.hand call it fromtest_eventso the binary also passes when run directly outside CTest.socket()failures so a descriptor-limit problem is reported as such rather than as abind()error.Test plan
ulimit -n 256; ctest --test-dir build -L 'unit|vendor'on macOS arm64: 33/33 pass (previouslytest_eventaborted)../build/bin/test_eventstill aborts under 256 fds whilectest -R test_eventpasses, confirming the launcher works on its own.unit|vendorsuite passes with the default fd limit.Fixes #3058
https://claude.ai/code/session_01PSG4XV3jiqitDgdgFSGATx