-
Notifications
You must be signed in to change notification settings - Fork 16
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
Set a small socket timeout before closing partially consumed responses #1853
base: develop
Are you sure you want to change the base?
Conversation
This works around a degenerate case in which closure isn't negotiated in a timely manner, and the client consumes far more bytes than desired in `SSLSocketInputRecord.deplete`.
Generate changelog in
|
ab754af
to
567a855
Compare
: "Expected ConnectionEndpointAccess.getConnectionEndpoint " | ||
+ "to extract a ConnectionEndpoint"; | ||
if (maybeEndpoint != null) { | ||
maybeEndpoint.setSocketTimeout(Timeout.ONE_MILLISECOND); |
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.
Should we set this to 0 so that the deplete tryToRead
arg is false
- https://github.com/openjdk/jdk17u/blob/2fe42855c48c49b515b97312ce64a5a8ef3af407/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java#L1221
- https://github.com/openjdk/jdk17u/blob/0a6252780a862e6d5646a28c2b22a1c03eff37bf/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java#L494
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 don't think so -- that would only skip the single-byte read call, not the skip
where most of the time is spent in a loop (with potentially no timeout)
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.
Yeah, makes sense so we should expect the skip to timeout after 1ms with no bytes
With some adjustments this could also handle #1814. |
Yep, I'd thought the same thing -- planning to take a look at it after some issues I'm currently digging into. |
This works around a degenerate case in which closure isn't negotiated in a timely manner, and the client consumes far more bytes than desired in
SSLSocketInputRecord.deplete
.After this PR
==COMMIT_MSG==
Set a small socket timeout before closing partially consumed responses
==COMMIT_MSG==