Skip to content

Fix flaky ConnectionFailTest: restore fd limit in SetUp - #612

Merged
merlimat merged 1 commit into
apache:mainfrom
merlimat:fix-flaky-connection-fail-test
Sep 1, 2026
Merged

Fix flaky ConnectionFailTest: restore fd limit in SetUp#612
merlimat merged 1 commit into
apache:mainfrom
merlimat:fix-flaky-connection-fail-test

Conversation

@merlimat

@merlimat merlimat commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Motivation

ConnectionFailTest fails intermittently in CI, e.g. https://github.com/apache/pulsar-client-cpp/actions/runs/33217535403/job/99014404956:

[ RUN      ] Unix/ConnectionFailTest.test/1
tests/unix/ConnectionFailTest.cc:40: Failure
Value of: res == 204 || res == 409
  Actual: false
Expected: true
res: -1

The test lowers the process soft fd limit (RLIMIT_NOFILE) in a loop and never restores it, so a test leaves the limit as low as ~8 for the next one (the failing run's test/0 ended with Updated fd limit to 8). The next test's SetUp() then makes an HTTP request to create the partitioned topic, and curl can intermittently fail to open a socket (res: -1) when the previous client's async connection teardown still holds file descriptors. Since run-unit-tests.sh runs this suite with --gtest_repeat=20 and no retry, a single flake fails the job.

Modifications

Restore the soft fd limit to the hard limit in SetUp() before making the HTTP request.

ConnectionFailTest lowers the process soft fd limit (RLIMIT_NOFILE) in a
loop and never restores it, so a test leaves the limit as low as ~8 for
the next one. The next test's SetUp() then makes an HTTP request to
create the partitioned topic, and curl can intermittently fail to open a
socket (res: -1) when the previous client's async connection teardown
still holds file descriptors.

Restore the soft limit to the hard limit in SetUp() before making the
HTTP request.
@merlimat
merlimat requested a review from lhotari September 1, 2026 15:39
@merlimat
merlimat merged commit f71d7e9 into apache:main Sep 1, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants