Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hang when client receives header response that's too big in http2 #3724

Closed
ajwerner opened this issue Aug 2, 2024 · 4 comments
Closed

hang when client receives header response that's too big in http2 #3724

ajwerner opened this issue Aug 2, 2024 · 4 comments
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@ajwerner
Copy link

ajwerner commented Aug 2, 2024

Version
Hyper @ 7de0237

Platform
Linux 6.5.0-42-generic

Description
When the server sends a response with headers that are too big, hyper can sometimes just hang.

I wrote this test:

// Test that clients get responses when the server sends a response with
// headers that are too large by just a bit.
t! {
long_header_response,
client:
request:
;
response:
status: 500,
headers: {
},
;
server:
request:
;
response:
status: 500,
headers: {
// Just above DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE.
"error" => ("a".repeat(16 << 10 + 1)),
},
;
}

I expected to see an error. Instead the test just blocks forever.

See hyperium/tonic#1834 and https://discord.com/channels/500028886025895936/1268954374634471484 for context.

@ajwerner ajwerner added the C-bug Category: bug. Something is wrong. This is bad! label Aug 2, 2024
ajwerner added a commit to ajwerner/h2 that referenced this issue Aug 2, 2024
Before this change, the transition to the reset state wouldn't notify
tasks that were waiting for a response. The motivating case for this
patch involved a large header being sent by the server. This case was
mostly tested by an existing test, but because that test did not spawn
separate tasks and kept polling the futures through its use of
`conn.drive`, the missing notify was masked.

Informs hyperium/hyper#3724.
seanmonstar pushed a commit to hyperium/h2 that referenced this issue Aug 2, 2024
Before this change, the transition to the reset state wouldn't notify
tasks that were waiting for a response. The motivating case for this
patch involved a large header being sent by the server. This case was
mostly tested by an existing test, but because that test did not spawn
separate tasks and kept polling the futures through its use of
`conn.drive`, the missing notify was masked.

Informs hyperium/hyper#3724.
@futile
Copy link

futile commented Dec 10, 2024

Hi, I think we might be running into this with lots of headers being sent to us by https://console.cloud.google.com. Thanks for the documentation, issues and PROTOCOL_ERROR-change in h2 already, which turned the hang into a PROTOCOL_ERROR for us instead!

Do you have any further updates on this already?

@ajwerner
Copy link
Author

Perhaps with hyperium/h2#791 this is resolved. What do y'all think?

@futile
Copy link

futile commented Dec 10, 2024

Mhhm, could it be possible to increase the header size limit on-demand (up to a fixed maximum)? Just thinking about a version that will allow clients/servers to work with large headers, instead of throwing an error.

@seanmonstar
Copy link
Member

Perhaps with hyperium/h2#791 this is resolved. What do y'all think?

Yea, the hang is likely solved, thanks!

increase the header size limit on-demand (up to a fixed maximum)

That's what a maximum does already. You can adjust the maximum with builder options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

No branches or pull requests

3 participants