-
Feature Request
-
Resolution: Unresolved
-
Major
-
None
-
3.7.0.Final
-
None
My application is using Resteasy 3.7.0.Final version. We are seeing thread hanging issue in out application. Connection manager doesn't shut down and jboss got killed which caused connection to hang and not released for re-use.
We checked netstat logs and saw connection was in close_wait state
netstat logs:
tcp 339 0 ::ffff:10.247.247.137:8080 ::ffff:10.247.247.14:50532 CLOSE_WAIT
As it can be seen in above logs, VM ip 10.247.247.14 is in CLOSE_WAIT state with VM ip 10.247.247.137. This state can be seen after upgrade till we restarted the services as workaround. Once Workaround was applied, I can see connection no longer in CLOSE_WAIT state.
I checked the code and we are using close() method which is valid but even though the server may have decided to close its end of the connection, the connection is still open on our client side and it will stay that way until an attempt to read from it is made (at which point the client will detect that the other end is closed). TCP works like that, there is the chances of a half-closed connection because close() actually just means I will not send any more data, but you can still receive data from a connection that you closed but that has not yet been closed on the other end. when the HttpClient instance goes out of scope, it becomes available to the GC, but it will not be garbage collected immediately. Until the GC collects it, the socket connection held internally will stay open and the socket will be stuck in the CLOSE_WAIT state.
Could you please help me to resolve this issue ? Or is it fixed in some higher version which we can use to solve this close_wait problem ??