-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixes #8405 - onAllDataRead() is called twice under h2 if the stream … #10174
Fixes #8405 - onAllDataRead() is called twice under h2 if the stream … #10174
Conversation
…times out Per Servlet semantic, HTTP/2 stream timeout should be ignored. The code was trying to fail the read via `_contentDemander.onTimeout()`, but then it was still calling `onContentProducible()`, which was returning `true` because the state of the read was IDLE (all the request content was read) and the request was suspended. Now the code checks if the read was really failed; if it is not, then `onContentProducible()` is not called and so the idle timeout is ignored. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a middle about the code clarity and the branch is out of date. But other than that, looks good. Update the branch and consider the niggle and I'll re review
boolean needed = getRequest().getHttpInput().onContentProducible(); | ||
boolean readFailed = _contentDemander.onTimeout(failure); | ||
boolean needed = false; | ||
if (readFailed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a simple && would be clear here.
Needed = on timeout && contentProducable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregw I disagree that it would be clearer to lose the variable names and rely on &&
short circuiting.
I have renamed needed
to handle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah! You can keep the variable name but get rid of the manual short-circuit:
boolean = readFailed && getRequest().getHttpInput().onContentProducible();
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…times out
Per Servlet semantic, HTTP/2 stream timeout should be ignored.
The code was trying to fail the read via
_contentDemander.onTimeout()
, but then it was still callingonContentProducible()
, which was returningtrue
because the state of the read was IDLE (all the request content was read) and the request was suspended.Now the code checks if the read was really failed; if it is not, then
onContentProducible()
is not called and so the idle timeout is ignored.