Operating System - Linux
1827894 Members
1740 Online
109969 Solutions
New Discussion

Re: resolving a close_wait status on a particular port

 
Andrew Kaplan
Super Advisor

resolving a close_wait status on a particular port

Hi there --

I have a server running Red Hat 7.3 and there is a CLOSE_WAIT status on a particular port that is preventing my starting a program that needs that port available. Is there a way, other than restarting the server, of resolving the CLOSE_WAIT status on the port? Thanks.
A Journey In The Quest Of Knowledge
7 REPLIES 7
Stuart Browne
Honored Contributor

Re: resolving a close_wait status on a particular port

netstat -nap | grep CLOSE_WAIT

Run this as 'root'. Does this list a PID?
One long-haired git at your service...
Andrew Kaplan
Super Advisor

Re: resolving a close_wait status on a particular port

It appears the pid is 29877. I am referring to the column after the CLOSE_WAIT entry which reads 29877/df.
A Journey In The Quest Of Knowledge
Andrew Cowan
Honored Contributor

Re: resolving a close_wait status on a particular port

After killing the process try a "service network" restart as this may refresh the port.
Sergejs Svitnevs
Honored Contributor

Re: resolving a close_wait status on a particular port

CLOSE_WAIT means that the system is waiting for the local process to close
the socket. The socket doesn't get closed until all the processes that have descriptors for it call close() (or terminate, since that automatically closes all of a process's descriptors).

So you need only to close your program which use a open socket in a listening mode.

Regards,
Sergejs
Andrew Kaplan
Super Advisor

Re: resolving a close_wait status on a particular port

I tried to kill the process using the kill -9 syntax as root, but it did not seem to have any effect. Despite that, I ran the service network restart command and while that went by without a problem, the CLOSE_WAIT status of port did not change.

I ran the ps -ef command and grepped for the application, but there was no listing of it.
A Journey In The Quest Of Knowledge
Andrew Cowan
Honored Contributor

Re: resolving a close_wait status on a particular port

If the process refuses to die, try killing the parent.
Tucker_1
New Member

Re: resolving a close_wait status on a particular port

Try lsof -i TCP |grep [port# | or named port defined in /etc/services] then kill the associated pid of that process. If this works it could then be incorporated into a script.