-
Bug
-
Resolution: Done
-
Major
-
7.4.8.GA
-
False
-
None
-
False
-
-
-
-
-
-
-
-
Truncate reponse can happen unexpectedly for request comming through keep-alive connection due to the force connection closure by the write-timeout setting. This is similar to JBEAP-20814 that happened with read-timeout setting. (Note that JBEAP-20814 does not happened for ajp-listener but only for http-listener. However, this issue happens on both http-listener and ajp-listener.)
If I understand correctly, the current write-timeout setting works like the following:
- WriteTimeoutStreamSinkConduit#handleWriteTimeout() checks if currentTime exceeds expireTime of the write-timeout and bump the expireTime if it's not expired.
- The WriteTimeoutStreamSinkConduit#handleWriteTimeout() check is triggered after the write() operation. So, the expiration basically happens when the duration takes longer than write-timeout between the multiple write() operations.
However, the problem is the expireTime in WriteTimeoutStreamSinkConduit never resets to -1 even after completing an exchange (request/response) or before starting an new exchange (request/response). So, the write-timeout can be easily expired for requests that come through the same keep-alive connections.
Also, the write() operation happens actually when flushing content to the response. So, it appears that the WriteTimeoutStreamSinkConduit#handleWriteTimeout() check happens after either of the following:
- after writing out all response content when the response content size is smaller than the default buffer size (16KB)
- after writing each response buffer (16KB) when the response content size is larger than the default buffer size (16KB)
- after an application invokes response flush() of ServletOutputStream (or Servlet Writer) explicitly
So, if the response content size is smaller than the default buffer size (16KB) and an application does not invoke response flush, the check happens after writing all content of the response. So, the problem is not revealed luckily in this scenario.
However, if the response content size is larger than the default buffer size (16KB) or an application invokes response flush() in pieces explicitly, this response truncate issue happens after writing the first buffer.
- clones
-
JBEAP-24358 [GSS](7.4.z) UNDERTOW-2228 - Undertow write-timeout can cause a truncate response for request coming through keep-alive connection
- Closed
- is cloned by
-
UNDERTOW-2228 [GSS](7.4.z) Undertow write-timeout can cause a truncate response for request coming through keep-alive connection
- Resolved