Friday, January 21, 2011

CLOSE_WAIT TCP connections

While we develop a Java application, we saw a lot of CLOSE_WAIT TCP connections.

netstat -pan | grep CLOSE_WAIT

This could lead to the following exception:

Thread Execute Exception java.net.SocketException: Too many open files

because a lot of sockets are still there occupanying linux system file descriptors.

The following command could be used to check the system limits.

ulimit -a

After testing and debugging, we found that some HttpURLConnection did not get disconnected
when exception happens. Fortunately we found the problem.

0 comments:

Post a Comment