Skip to content

test: tolerate curl send errors when the listener closes during shutdown - #2724

Open
dunglas wants to merge 1 commit into
mainfrom
fix/shutdown-test-race
Open

dunglas wants to merge 1 commit into
mainfrom
fix/shutdown-test-race

Conversation

@dunglas

@dunglas dunglas commented Oct 16, 2026

Copy link
Copy Markdown
Member

tests/shutdown_test.sh (added in #2645) failed on #2721 with FAIL: PHP request failed with curl exit code 55 (job). The failure lines up with the last server log line, servers shutting down; grace period initiated, logged when Caddy closes its listeners after shutdown_delay.

Closing a listening socket resets the connections still waiting in its accept queue. Depending on when the reset reaches curl, the request fails with 52 (empty reply), 56 (receive error) or 55 (send error). The test already treated 52 and 56 as closing, but not 55, which needs the reset to arrive between connect() and the first send().

Stressing the shutdown in a Linux container (40 restarts, 24 concurrent clients, ~36k requests against main) produced 29 脳 52 and 30 脳 56 at listener close and no other errors, so 55 is the same race with a narrower window. The server can't prevent it, so the test now accepts 55 too. The checks that matter are unchanged: requests served during shutdown_delay, in-flight requests drained, PHP shut down last. The patched script passed 10/10 runs in the same container.

@dunglas
dunglas marked this pull request as ready for review October 16, 2026 21:59

This branch has not been deployed

No deployments
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