Community
Participate
Working Groups
It is possible that the server ends up in a spinning situation if the client sends some data and immediately after closes the connection. The server will catch an exception trying to read, and attempt to close the connection. However, ChannelEndPoint.close() does a 2 step close: first it shuts down the output then closes the channel. If the shutdown throws an exception (the client has already closed the connection, so the FIN cannot be sent), then the channel is never closed. This leaves the server in a state where it tries to write the response because it thinks that the channel is open, spinning.
Added a try/catch block to make sure the channel is closed even if shutdownOutput() throws.