> This fixes a regression introduced by 
> [JDK-8317808](https://bugs.openjdk.org/browse/JDK-8317808). If the server 
> sends all the response bytes, sends a GOAWAY, and immediately closes the 
> connection since all streams are closed on its side, the client may fail to 
> complete the request properly although all bytes have been received.
> Upon noticing that the connection is closed the client will interrupt all 
> exchanges, even those for which all bytes have been received (but not yet 
> pulled).
> 
> This typically happens when the response body is delivered as an InputStream.
> 
> The same issue also happens with HTTP/3.
> 
> For HTTP/2 we will allow the BodySubscriber to continue pulling the bytes, 
> unless we notice that the bodyCF is completed exceptionally. 
> 
> For HTTP/3 the logic is a bit different: when the connection is closed it 
> forcefully terminates all exchanges. We will skip those exchange for which 
> the underlying QUIC receiving stream state is DATA_READ or DATA_RCVD (and 
> which are not blocked by QPack)
> 
> Testing:
> 
> A new scenario is added to 
> test/jdk/java/net/httpclient/http2/H2GoAwayPromptConnectionClose.java to test 
> the HTTP/2 changes. A new test is added for HTTP/3. 
> 
> Both tests fail without the fix and pass with it. Failure without the fix is 
> not 100% guaranteed, but my experiments saw the tests reliably failing.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Daniel Fuchs has updated the pull request incrementally with one additional 
commit since the last revision:

  Update src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
  
  Co-authored-by: Daniel Jelinski <[email protected]>

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/33385/files
  - new: https://git.openjdk.org/jdk/pull/33385/files/e1222f17..7e3f8a63

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=33385&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33385&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/33385.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33385/head:pull/33385

PR: https://git.openjdk.org/jdk/pull/33385

Reply via email to