Closed forchid closed 5 years ago
We have never seen such problem. A stale socket usually results in a "Connection reset" which is a SocketException
.
Can you provide a test scenario which demonstrates the issue?
What OS do you run? Does one-nio use native NativeSockets or JavaSockets?
Using JavaSocket and Windows 8.1 x64.
Ah, that's Windows. Understood. Modified RpcClient/HttpClient to handle IOException instead of SocketException.
But please be aware that Windows is not a supported one-nio platform. JavaSockets are for development purpose only. Production systems should use NativeSockets.
The RpcClient can't acquire a socket at the first time after the peer restarted, because the IOException is thrown when the client invokes the remote method, and the RpcClient only catch SocketException instead of IOException in one.nio.rpc.RpcClient:
But the sendRequest() method can throw IOException after the peer socket closed:
This issue also exists in one.nio.http.HttpClient.invoke() method: