-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
Panic in FlowControl::send_data (self.window_size >= sz as usize) #607
Comments
@nox Hi nox, do you have any clue on this? |
I encounter the same issue occasionally with v0.3.21. To catch more useful info, I manually add more logs inside h2. But it is not easy to reproduce it. Does the panic indicate some programming errors outside the h2 library or some possible internal bugs? |
I've changed basically the same assert in code which executed earlier and added more context to assert message to see the actual values which triggers asserts:
Assert hit several time a day, so far I've got those:
There are some additional asserts I've observed also on modified version of h2 with assert in flow control:
|
Enriched assert even more, here is some data from crashes:
|
Hello @Noah-Kennedy, Apologies for reaching out here as well, but I came across your message in Discord regarding this issue a few days ago. I’m not sure if you saw my question there, so I hope you don’t mind if I repeat it here: did you uncover any insights into the issue after your investigation? From your message, it seems that you identified the problem as occurring during graceful shutdown. Could you please share any additional details? Perhaps with more context, it would be possible to create a stress test to replicate the issue. So far, I’ve gathered enriched assertion messages from crashes, but they haven’t provided much useful information beyond indicating that the assertion fails on connections with moderately long lifespans (based on the stream ID value). I’m also working on collecting core dumps, though I’m unsure if they’ll yield more actionable insights. I’ve tried several artificial stress tests, similar to hammer.rs, and attempted to multiplex 1,000 concurrent requests via a single H2 connection backed by Any pointers or insights you could share would be greatly appreciated. Thank you in advance! |
I notice there's a couple TODOs in there around "proper error handling" of |
@seanmonstar, I’ve also noticed that there are some TODOs related to flow control window handling. However, since I don’t have a complete picture of how this was originally intended to work, I’m unsure if these TODOs could trigger as issues in real-world scenarios. On my end, I’m now considering trying a custom version of |
Looking a bit closer, could it be related to a connection adjusting the SETTINGS_INITIAL_WINDOW_SIZE? It's possible the increase or decrease might not be fully accounted for with |
AFAICT, the only place where h2/src/proto/streams/prioritize.rs Lines 796 to 798 in 3bce93e
The only place where it is increased is in h2/src/proto/streams/prioritize.rs Lines 327 to 328 in 3bce93e
In h2/src/proto/streams/prioritize.rs Lines 726 to 728 in 3bce93e
h2/src/proto/streams/prioritize.rs Lines 764 to 766 in 3bce93e
In h2/src/proto/streams/prioritize.rs Lines 449 to 456 in 3bce93e
So I guess the issue is that |
One weird thing I've noticed is that in h2/src/proto/streams/prioritize.rs Lines 786 to 791 in 3bce93e
h2/src/proto/streams/prioritize.rs Lines 796 to 798 in 3bce93e
Why do we increase it at all? In which case should |
Seems like in Lines 518 to 519 in 3bce93e
|
I also find this snippet a little weird: h2/src/proto/streams/prioritize.rs Lines 414 to 424 in 3bce93e
First assert says "Note: the window size can go lower than assigned", but then we do stream.send_flow.window_size() - stream.send_flow.available().as_size() in the second snippet. Can't this underflow?
|
I've been looking into an old assertion failure discovered with fuzzing at #692 (comment), not sure if related or not, but there are some weird window size shenanigans going on there with send-closed streams. |
When capacity is assigned to a stream, |
In h2/src/proto/streams/prioritize.rs Lines 347 to 359 in 3bce93e
But we know that h2/src/proto/streams/prioritize.rs Lines 261 to 271 in 3bce93e
I think the issue is that we don't account for available capacity when reclaiming reserved capacity. |
Reclaiming requested capacity that has not been actually reserved yet is wrong, as this capacity never existed to begin with.
Reclaiming requested capacity that has not been actually reserved yet is wrong, as this capacity never existed to begin with.
@nox thank you very much for investigating and fixing the issue, I've no longer see crashes (4+ days) from the assert when upgraded to version of h2 with your fix. |
Hello @seanmonstar, sorry for bothering you. Are there any plans to release new version of h2 with fix of this issue included? |
* Fix reclaiming reserved capacity (fixes <hyperium/h2#607>) by @nox in <hyperium/h2#832> * Fix busy loop on shutdown by @seanmonstar in <hyperium/h2#834> * Fix window size decrement of send-closed streams by @nox in <hyperium/h2#830> * Fix handle implicit resets at the right time by @nox in <hyperium/h2#833> * Fix poll_flush after poll_shutdown by @bdbai in <hyperium/h2#836> Co-authored-by: Sean McArthur <sean@seanmonstar.com> Co-authored-by: 包布丁 <htbai1998m@hotmail.com> Co-authored-by: Anthony Ramine <123095+nox@users.noreply.github.com> Co-authored-by: Samuel Tardieu <sam@rfc1149.net>
The text was updated successfully, but these errors were encountered: