Killing CLOSE_WAIT sockets without killing parent process on Linux
- by Alex Neth
Tomcat is leaving me with CLOSE_WAIT sockets which ultimately saturate the maximum number of connections.
I've tried many methods in my client and server code to get rid of these to no avail, including closing connections, calling System.gc(), etc.
Now I'm trying to find a way to simply time these out quickly in the OS. I've got conntrack working, but am not sure how to use that to kill these connections. I've also set /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_close_wait to 1, which of course is too low but the connections persist.
Is there a way to kill these zombie sockets?
Running Ubuntu.