← BYTES
Unix IPC·Starter·Ref: 15.1.36
What is one simple way to clear a pile of CLOSE_WAIT sockets stuck on a running process, short of fixing the underlying code bug?
Have a question about this video? Mention reference 15.1.36 when you contact us.
a.Reboot the entire network router
b.Wait exactly 60 seconds and they disappear automatically, the same as TIME_WAIT
c.Change the server's IP address
d.Restart (or kill) the offending process -- when a process exits, the kernel automatically closes every file descriptor it was holding, including those stuck sockets
Restarting the process is the practical, immediate workaround (not a fix for the underlying bug): when any process exits, the kernel closes every open file descriptor it held -- including sockets stuck in CLOSE_WAIT -- which sends the final FIN each of those connections was still waiting on, clearing them. Unlike TIME_WAIT, CLOSE_WAIT has no automatic timeout of its own.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES15136#UnixIPC