Repository navigation
actix: unwind on panic, so one oversized header name no longer kills the server - #1851
Merged
Merged
Conversation
…the server Http11Probe's MAL-LONG-HEADER-NAME sends a 100,000-byte header name. httparse accepts it, actix-http 3.20 unwraps HeaderName::from_bytes(), which refuses names over 65,535 bytes, and with panic = "abort" that one request ended the process (exit 139): the h1 suite was saved as crashed, 120/159, with the 23 tests after it failing to connect. Dropping panic = "abort" leaves the default, unwind. Every connection is its own task, so tokio catches the panic and only that connection is dropped. Locally the suite now completes, 143/159.
Owner
Author
|
/benchmark --save |
Contributor
|
👋 Benchmark request received. A collaborator will review and approve the run. |
Contributor
Benchmark ResultsFramework:
Composite score, main against this run, in the board's default view:
The results on main were measured in another session, so a few points up or down can be the machine and not the change. Compliance
H/1.1: 16 failed
H/2: 1 failed
Full log |
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.
actix's H/1.1 compliance score is saved as a crash (120/159, from #1782's run): the server died partway through Http11Probe. This PR finds the cause and fixes it. It also covers CON-1M and CON-1M-TLS, which actix already subscribes to but has no results for.
The crash
The job log of the run that saved the score shows the panic, followed by exit 139:
MAL-LONG-HEADER-NAMEsends one request with a 100,000-byte header name. httparse accepts it: every byte is a token character, and the request fits in actix-http's 128 KiB head buffer. actix-http then builds each name withHeaderName::from_bytes(..).unwrap(), andhttprefuses names longer than 65,535 bytes. Because the entry built withpanic = "abort", that one request ended the process, and the 23 tests after it all failed with "Failed to connect". The test itself was scored as a pass, because the connection closed.The
unwrap()is still on actix-web's main, so no actix-http release fixes it.The fix
This drops
panic = "abort"from[profile.release], which leaves Rust's default, unwind. actix-server runs each connection as its own task, and tokio catches a panic inside a task. Now the request only costs its own connection, and the worker keeps running. Any actix-web app built with the default profile already behaves this way.The complete fix is a 400 response. That needs actix-http to map the error to
ParseError::Headerinstead of unwrapping it, which is a change to actix-web itself, not to this entry.Checked on the dev box
abort)validate.sh actixCONNECT(3), chunk-extension and trailer syntax (4),408on an incomplete or empty request (2), a 100 KB header value and a 100 KB method that get an answer instead of a rejection (2), and aPOSTWebSocket upgrade that gets no response (1).http2/5.1/8andhttp2/6.9.1/3race the server's response against the client's next frame. On the dev box they also fail intermittently with main's image (one of the two failed in each of 6 runs), so the failures come from timing, not from this change. The bench host passed both.CON-1M and CON-1M-TLS
actix has subscribed to both since #1815, which also raised its connection cap to
max_connections(100_000)per worker. No run has saved a row for it yet, because #1843 saved genhttp-ioxide only. Nothing else is needed. Both listeners bind0.0.0.0: validation reached them on 127.0.0.2 and 127.0.0.32, with :8081 over TLS 1.3. actix's 5 s keep-alive and first-request timeouts are longer than the 4 s pacing.connections-5mstays listed but is skipped, because actix is not on its allowlist.The panic strategy changes codegen for the whole binary. A full run with
--saveon this PR would refresh every actix row, save the spec scores, and add CON-1M and CON-1M-TLS. I took no performance numbers on the dev box.🤖 Generated with Claude Code