The GitHub Actions job "Validate and test" on 
pekko-http.git/http2-release-buffered-data-on-shutdown has succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
62ddc4ff27999cfd974cedc38185a38b94df5b1c / PJ Fanning 
<[email protected]>
fix: release buffered data accounting when an incoming HTTP/2 stream is shut 
down

Motivation:
`IncomingStreamBuffer.shutdown()` fails the entity outlet and drops
whatever is still buffered, but unlike the other discard paths
(`onRstStreamFrame`, `onDownstreamFinish`) it never subtracted those
bytes from `totalBufferedData`.

One of its callers leaves the connection running: when a peer sends more
data than the stream-level window allows, `onDataFrame` resets that
single stream with FLOW_CONTROL_ERROR and carries on. The bytes still
buffered for the stream, plus the payload of the frame that is dropped
without ever being buffered, keep counting as buffered for the lifetime
of the connection. The connection-level flow controller only emits a
WINDOW_UPDATE while `outstanding + buffered` stays below half of
`incoming-connection-level-buffer-size`, so the leaked accounting
permanently reduces - and once it reaches half the buffer size, stops -
the replenishment of the connection window, and every stream on that
connection stalls.

Modification:
Release the buffer in `IncomingStreamBuffer.shutdown()` via the existing
`discardBuffer()`, and subtract the payload of the frame that trips the
stream-level window check, since that frame is never buffered either.

Result:
Resetting a stream for a flow-control violation releases the
connection-level window its data reserved, so the connection keeps being
replenished and no longer stalls.

Tests:
- New test "release connection-level flow control accounting when a 
stream-level window is exceeded" makes a peer overrun the stream window with 
the connection-level buffer sized so the discarded frame is more than half of 
it, then asserts the connection window is handed back in full. Without the fix 
no WINDOW_UPDATE is emitted at all.
- sbt "http2-tests/testOnly 
org.apache.pekko.http.impl.engine.http2.Http2ServerSpec" - Not run - 
environment failure: `http2-tests / update` cannot resolve 
`io.github.summerwind:h2spec_darwin_amd64:2.6.0` ("h2spec_darwin_amd64.tar.gz 
not found under 
https://github.com/summerwind/h2spec/releases/download/v2.6.0/";), which blocks 
the whole module. Verified on CI instead.
- The first CI run failed on the new test only, with "requirement failed: 
incoming-connection-level-buffer-size must be > 0": the buffer size was a `val` 
in the anonymous setup class, which is initialised after the superclass 
constructor has already read `settings`. The constants now live outside that 
class.

References:
None - releases buffered-data accounting when the incoming side of a stream is 
shut down

Report URL: https://github.com/apache/pekko-http/actions/runs/34101195211

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to