Skip to content

test: fail the keep-alive stop test when the connection stays open - #5939

Merged
leaf-agent merged 1 commit into
mainfrom
nightly/keep-alive-test-timeout-fails
Nov 14, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
nightly/keep-alive-test-timeout-fails

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_server_stop_closes_accepted_keep_alive_connections can pass when the connection it checks stays open. Its final read caught OSError, which includes TimeoutError. A socket the stopped server left open, such as one a surviving child process inherited, doesn't close: the read times out after STATED_TIMEOUT. The test took that timeout for a close and passed, although it is exactly the failure the test exists to catch. tests/AGENTS.md rules that a time limit must never turn unfinished work into a pass.

The read now accepts only end of stream, ConnectionResetError or BrokenPipeError as the close, and a timeout fails the test. No product code changes.

Verification. The test passed in five runs here, so a real close still shows up as one of those three outcomes. On this runner's Python, a timed-out recv raises TimeoutError, and isinstance(error, OSError) is true.

Found by the nightly survey of tests/model/test_server_lifetime.py.

test_server_stop_closes_accepted_keep_alive_connections caught `OSError`
around its final read, and `TimeoutError` is an `OSError`. A connection a
stopped server left open, such as one a surviving child process inherited,
times out rather than closing, so the test read that as a close and passed.
It now accepts only end of stream, a reset or a broken pipe as the close.

Behavior protected: `leaf server stop` closes the keep-alive connections the
server accepted; a timeout now fails the test instead of passing it.
@leaf-agent
leaf-agent merged commit 04f71ad into main Nov 14, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the nightly/keep-alive-test-timeout-fails branch November 14, 2026 07:05
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