Skip to content

fix(tests): Stop waiting forever for the test server to start - #2330

Merged
Litarnus merged 1 commit into
masterfrom
fix/test-server-startup-timeout
Nov 6, 2026
Merged

Litarnus merged 1 commit into
masterfrom
fix/test-server-startup-timeout

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

TestServer::startTestServer() started php -S on the fixed port 45884 and then polled /ping in a while (true) loop. If the server couldn't bind or died on startup, the loop never ended. It only checked whether the process was alive after the loop, which it never reached. The CI job then hung until GitHub's 6h job limit, with no hint of which test was stuck. That's the likely cause of the Tests (ubuntu-latest, 8.3, lowest) hang on #2329, which stopped somewhere between tests 672 and 732. Every test in that range that starts the test server is in AgentClientBuilderTest or HttpClientTest.

This gives the test server the same treatment the test agent got in #2222:

  • A free port is picked on every start instead of 45884. That port is inside Linux's ephemeral range, so other connections on the runner can occasionally be holding it.
  • The readiness loop gives up after 5 seconds, and fails right away if php -S has exited. The error message includes the server's stderr, e.g. Failed to listen on 127.0.0.1:39315 (reason: Address already in use).
  • On a failed start, the process is killed and closed before the exception is thrown, so tearDown() doesn't trip over a half-started server.

The server now binds to 127.0.0.1 instead of localhost, so it listens on the same address the free port was reserved on.

via Martin Linzmayer.

--

View Session [Sentry]

Co-Authored-By: Martin Linzmayer <martin.linzmayer@sentry.io>
@Litarnus
Litarnus merged commit 653e782 into master Nov 6, 2026
56 checks passed
@Litarnus
Litarnus deleted the fix/test-server-startup-timeout branch November 6, 2026 17:02
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.

1 participant