test/syscalls: fix DataTransferStressTest.BigDataTransfer port exhaustion#13324
Merged
copybara-service[bot] merged 1 commit intoJun 4, 2026
Conversation
…tion socket_stress_test shard 1 deterministically failed when PersistentListenerConnectStressTest and DataTransferStressTest landed in the same shard (kvm platform, netstack): the connect-stress tests shrink the ephemeral pool to ~50 ports via MaybeLimitEphemeralPorts() and fill it with TIME-WAIT 4-tuples, so the persistent listener's bind(port=0) for BigDataTransfer fails with EADDRINUSE. Worse, that bind ran through .ValueOrDie() and aborted the whole binary instead of failing gracefully. socket_generic_stress.cc: widen the ephemeral range back to the full 16-bit space at the top of BigDataTransfer (tolerating EACCES when the /proc file is read-only, e.g. hostinet as root). SO_REUSEADDR is added to the instantiations only for parity with PersistentListenerConnectStressTest; it applies to the connect/accept pair, not the shared listener. socket_util.cc: TCPAcceptBindPersistentListenerSocketPairCreator now propagates the bind/listen PosixError and resets the unbound cached listener so a retry doesn't reuse a poisoned fd, instead of TEST_CHECK aborting. Validated: socket_stress_test_runsc_kvm passes 24 runs (runs_per_test=3 x 8 shards), previously failed 1/8 every time. Signed-off-by: Tianyu Zhou <albert.zty@antgroup.com>
ayushr2
approved these changes
Jun 1, 2026
copybara-service Bot
pushed a commit
that referenced
this pull request
Jun 4, 2026
…tion socket_stress_test shard 1 deterministically failed when PersistentListenerConnectStressTest and DataTransferStressTest landed in the same shard (kvm platform, netstack): the connect-stress tests shrink the ephemeral pool to ~50 ports via MaybeLimitEphemeralPorts() and fill it with TIME-WAIT 4-tuples, so the persistent listener's bind(port=0) for BigDataTransfer fails with EADDRINUSE. Worse, that bind ran through.ValueOrDie() and aborted the whole binary instead of failing gracefully. * socket_generic_stress.cc: widen the ephemeral range back to the full 16-bit space at the top of BigDataTransfer (tolerating EACCES when the /proc file is read-only, e.g. hostinet as root). SO_REUSEADDR is added to the instantiations only for parity with PersistentListenerConnectStressTest; it applies to the connect/accept pair, not the shared listener. * socket_util.cc: TCPAcceptBindPersistentListenerSocketPairCreator now propagates the bind/listen PosixError and resets the unbound cached listener so a retry doesn't reuse a poisoned fd, instead of TEST_CHECK aborting. Validated: socket_stress_test_runsc_kvm passes 24 runs (runs_per_test=3 x 8 shards), previously failed 1/8 every time. FUTURE_COPYBARA_INTEGRATE_REVIEW=#13324 from tianyuzhou95:albert/fix-bigdatatransfer-port-exhaustion be8d225 PiperOrigin-RevId: 924456837
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.
socket_stress_test shard 1 deterministically failed when PersistentListenerConnectStressTest and DataTransferStressTest landed in the same shard (kvm platform, netstack): the connect-stress tests shrink the ephemeral pool to ~50 ports via MaybeLimitEphemeralPorts() and fill it with TIME-WAIT 4-tuples, so the persistent listener's bind(port=0) for BigDataTransfer fails with EADDRINUSE. Worse, that bind ran through.ValueOrDie() and aborted the whole binary instead of failing gracefully.
socket_generic_stress.cc: widen the ephemeral range back to the full 16-bit space at the top of BigDataTransfer (tolerating EACCES when the /proc file is read-only, e.g. hostinet as root). SO_REUSEADDR is added to the instantiations only for parity with PersistentListenerConnectStressTest; it applies to the connect/accept pair, not the shared listener.
socket_util.cc: TCPAcceptBindPersistentListenerSocketPairCreator now propagates the bind/listen PosixError and resets the unbound cached listener so a retry doesn't reuse a poisoned fd, instead of TEST_CHECK aborting.
Validated: socket_stress_test_runsc_kvm passes 24 runs (runs_per_test=3 x 8 shards), previously failed 1/8 every time.