Skip to content
New issue

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

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

Already on GitHub? # to your account

HTTP/2 responses with Content-Length may have no content #12249

Closed
sbordet opened this issue Sep 8, 2024 · 0 comments · Fixed by #12250
Closed

HTTP/2 responses with Content-Length may have no content #12249

sbordet opened this issue Sep 8, 2024 · 0 comments · Fixed by #12250
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@sbordet
Copy link
Contributor

sbordet commented Sep 8, 2024

Jetty version(s)
12

Description
Since #10655, a RST_STREAM frame may drain unread DATA frames in HTTP2Stream.

It is possible that the server sends a good response with content, but fails to fully read the request content, and this results in a RST_STREAM to be sent to the client.

The client may see the response headers, possibly indicating a Content-Length header with a positive value, but may decide to read the response content later.
This results in the DATA frames to be queued in the stream, but then the RST_STREAM drains them.

There is a small window between draining the DATA frames and notifying the upper layer that a RST_STREAM was received.

If an application tries to read during that small window, it reads an EOF chunk, rather than a failure chunk, and it may think the response was successful and had no content, even if the Content-Length header indicated that there was content.

This is the reason for the flakyness reported by #11960.

@sbordet sbordet added the Bug For general bugs on Jetty side label Sep 8, 2024
@sbordet sbordet self-assigned this Sep 8, 2024
@sbordet sbordet moved this to 🏗 In progress in Jetty 12.0.14 Sep 8, 2024
sbordet added a commit that referenced this issue Sep 8, 2024
Fixed HttpReceiverOverHTTP2.read() to return a failed chunk if the stream has been reset.
This closes the window where a RST_STREAM frame may be received, drain the DATA frames in HTTP2Stream, and the application reading exactly at that point.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet closed this as completed in fa0502d Sep 9, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Jetty 12.0.14 Sep 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant