-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Closed
Copy link
Labels
BugFor general bugs on Jetty sideFor general bugs on Jetty side
Description
Jetty version(s)
12.0.11
Jetty Environment
core
Java version/vendor (use: java -version)
OpenJDK 17.0.10
OS type/version
Windows
Description
Executing a JettyClientHttpRequest throws an IllegalArgumentException with message Self-suppression not permitted if a SocketTimeoutException occurs when writing the response.
This is similar to #11736.
Reason
- In
JettyClientHttpRequest.executeInternalanOutputStreamis constructed fromrequestContent.getOutputStream()and thebodyis written to it - That stream is of type
OutputStreamContentSource.AsyncOutputStream - During writing of the body, a flush might be performed triggering
AsyncOutputStream.write - The write delegates to
AsyncOutput.writeand theSocketTimeoutExceptionmay arise (let's assume that) - That exception is caught and written to
persistentFailureand thrown (and rethrown) inAsyncOutputStream.write. JettyClientHttpRequest.executeInternal's try-with-resources-block notices the exception and tries to close the output stream- Closing the stream again causes a
flushwhich repeats thepersistentFailure - Java notices that the try-with-resources block's finally-block throws and wants to suppress the original exception (from the write) - but it's exactly the same exception again, which leads to the
IllegalArgumentException
How to reproduce?
Try to send a large enough request to an unresponsive host causing an intermediate flush.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugFor general bugs on Jetty sideFor general bugs on Jetty side