trnguyencflt opened a new pull request, #23933:
URL: https://github.com/apache/kafka/pull/23933

   When a TLS `close_notify` arrives in the same read as application data,
   `SslTransportLayer.read` returns the data and leaves the close for a
   later read, but `updateBytesBuffered` clears `hasBytesBuffered`, so the
   Selector never reads the channel again unless a TCP FIN arrives. A peer
   may close only its TLS write side and keep the TCP connection open
   (RFC 8446 section 6.1, e.g. a TLS-terminating proxy), and a request on
   that connection then waits for `request.timeout.ms`.
   
   The channel now stays in the buffered-read set after a `CLOSED` unwrap,
   and the next read throws `EOFException` once the engine's inbound side
   is done, so the disconnect is reported at once, as it already is when
   `close_notify` arrives without data. A scattering read returns the
   bytes it has already read instead of losing them to that exception.
   
   Testing: new tests in `SslTransportLayerTest`, where a TLS peer sends a
   partial or a full response plus `close_notify` in one write and keeps
   the TCP connection open. The client must report the disconnect within
   5 s (and deliver the full response), including when the channel is
   muted after the response and later unmuted. The tests fail without the
   fix.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to