hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 269 forks source link

hang on `poll_capacity` with larger than default max send buf payloads #584

Closed robjtede closed 2 years ago

robjtede commented 2 years ago

continuing from conversations in #582

some snippets from my logging in case it helps:

v0.3.7 ``` pl len: 655360 handling response preparing response creating stream was not eof polling body polled body got chunk send loop; reserving capacity for 16384 stream capacity before: 0 stream capacity after reserve: 16384 polling stream capacity capacity ok: 16384 write chunk is chunk empty: false ... ... ... send loop; reserving capacity for 16384 stream capacity before: 0 stream capacity after reserve: 16384 polling stream capacity capacity ok: 16384 write chunk is chunk empty: false send loop; reserving capacity for 16384 stream capacity before: 0 stream capacity after reserve: 16384 polling stream capacity capacity ok: 16384 write chunk is chunk empty: true sending EOF chunk done loading body CLIENT: read 16384 bytes ... ... ... CLIENT: read 16384 bytes CLIENT: read 0 bytes test test_h2_body ... ok ```
v0.3.8 ``` pl len: 655360 handling response preparing response creating stream was not eof polling body polled body got chunk send loop; reserving capacity for 16384 stream capacity before: 0 stream capacity after reserve: 16384 polling stream capacity capacity ok: 16384 write chunk is chunk empty: false ... ... ... send loop; reserving capacity for 16384 stream capacity before: 0 stream capacity after reserve: 16384 polling stream capacity capacity ok: 16384 write chunk is chunk empty: false send loop; reserving capacity for 16384 stream capacity before: 0 stream capacity after reserve: 0 polling stream capacity send loop; reserving capacity for 16384 stream capacity before: 16384 stream capacity after reserve: 16384 polling stream capacity loading body CLIENT: read 16384 bytes ... ... ... CLIENT: read 16384 bytes *** hangs here *** ```
robjtede commented 2 years ago

I've noticed in debugging this that the penultimate poll_capacity call (before hanging) returns 0 which seems odd but indeed the client reports that it received a data frame with 0 length. As I understood it, this should only happen on EOF.

seanmonstar commented 2 years ago

I've managed to write a unit test now that seems to hang, and am working on a fix, but may take longer than just a new release with the default relaxed (#583).