AbstractListenerReadPublisher does not call ServletOutputStream::isReady()
when reading chunked data across network packets
#28241
Milestone
When a client POSTs data using chunked encoding, and a network packet ends immediately after the chunk header, but before the chunk body, the
AbstractListenerReadPublisher
hangs under Tomcat, especially in constrained environments.When the packet that ends with the chunk header is received, Tomcat calls
ReadListener::onDataAvailable()
.The
ServletServerHttpRequest.RequestBodyPublisher
callsServletOutputStream::isReady()
, which returnstrue
.The
RequestBodyPublisher
tries to read data, and Tomcat processes the chunk header (so data has been read from the network).However, there is no actual content available (yet), so Tomcat returns 0 bytes.
The
RequestBodyPublisher
sees no data has been read, and switches state to DEMAND.The
RequestBodyPublisher
doesn't callisReady()
because it assumes the read terminated, asisReady()
returnedfalse
.No call to
isReady()
means the socket is not registered for read and everything hangs.Special thanks to @markt-asf for investigating the issue, and providing the description above.
The text was updated successfully, but these errors were encountered: