Closed cmebarrow closed 7 years ago
We should not report this condition like an unexpected error (as we do other exceptions caught in the reaktor) because it is a frequent condition that clients abruptly close a connection (e.g. mobile phones). We should report it in a separate counter. The same applies for subsequent attempts to write to the channel on which the IOException (RST) occurred.
Looking at the jdk source code and the Microsoft Windows Socket API documentation there is no reliable way to distinguish an IOException from SocketChannel.read due to client sending a RST from any other one. Proposed solution from discussion with John is:
CloseHelper.quietClose(channel);
) Testing shows any subsequent attempt to write to the socket channel will result in an exception (which will be reported as a RESET frame to the writer). It doesn't appear there is any value in immediately reporting a RESET to the writer when we catch the exception from the read.
Orderly Versus Abortive Connection Release in Java is a very useful link.
Fix merged, closing.
I accidentally hit this while working on a test. The console output was:
This can be reproduced by adding the following test case to ServerIT and running it several times (the problem does not always occur, it obviously depends on timing):