Repository navigation
tests: stop half-closing in the httpserver framing/chunked raw() helper - #1211
Merged
Merged
Conversation
The lws h1 server treats the client's FIN as a full close and drops a response the handler hasn't written yet, so half-closing before reading made these tests flaky. Read until EOF (every request sends Connection: close) with one 5 s deadline instead of a 500 ms per-read race, and drop the GC stress skip in the chunked test. Refs #1207
Owner
Author
|
Reviewer verdict (devteam t_7692981b): approved at 90fffd0.
|
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.
What
In
tests/test-httpserver-chunked.jsandtests/test-httpserver-framing.js, theraw()helper no longer half-closes the socket (writer.close()) before reading the response. It now reads until EOF, bounded by one overall 5 s deadline per call (its timer is cleared when the loop ends), instead of a 500 ms per-read idle race. Assertions and request bytes are unchanged. TheTJS_GC_STRESSskip in the chunked test is removed, since the read-timeout race it blamed is gone.Why
The lws h1 server treats the client's FIN as a full close and closes the connection at once. If the JS handler hasn't written its response yet, the response is dropped and the client sees EOF, so raising the timeout would not help. That is why these tests flaked on macOS Debug and in GC Stress (Linux). Every request already sends
Connection: close, so the server always closes after answering and EOF always arrives. The server behaviour itself is tracked separately.Refs #1207
How verified
A local-only repro adds
await new Promise(r => setTimeout(r, Number(tjs.env.HDELAY || 0)));afterconst body = await req.text();in each handler. This line is not committed.HDELAY=200 tjs run chunked0/5 (valid split chunked body is echoed);HDELAY=200andHDELAY=0 tjs run framing0/5 each (plain Content-Length request is accepted)./build/tjs test tests/: all pass;make lint: cleanDevteam card: t_7692981b