We have a application that connects to a external billing server. Once there was a outage in the server in the client side there was hundreds of connections in the CLOSE_WAIT state.
I have checked the client code. And it seems the client is closing TCP connections properly.
If this happened because server not closing the connection properly because of an issue form the server side, is there a way to prevent the client form keep sockets in CLOSE_WAIT state?
I also observed that the thread count and the cpu usage has gone up more than usual.
After a application restart, there were no CLOSE_WAIT build up even after several hours, and the thread count and cpu usage was back to normal.
If sever some times failed to close the connection properly, don't we have anything to do other than restarting the client to remove CLOSE_WAITs? ( I mean is there any code improvement which can prevent this problem in client side)
We use customised JDiameter code in the client side to connect to the billing server.
(We have no access to the server side code)