Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a program that listens on a port to receive info on running a report. Upon closing and reopening the program, we get an error saying that the port it uses is already in use. Looking at netstat, we see that there are 9 instances of that port in the CLOSE_WAIT state and 1 instance of it in the listening state. The instance that's in the listening state says that it's owned by pid 488. Task Manager shows that there is no process with that ID and taskkill says the same. The app is an in-house .NET application.

This is a production environment so we want to avoid restarting the machine. What might cause this and what can be done to fix it?

share|improve this question
add comment

1 Answer

CLOSE_WAIT means that the socket has received a FIN packet from the other end and is waiting to be closed by the application owning that listen socket. Not calling close() on a listening socket can cause it to float about, as it has done for you.

As it's an in-house .NET application I'd double check your source code to ensure that the socket is being close()'d properly prior to exiting.

More information on socket states, including CLOSE_WAIT: http://blogs.technet.com/b/janelewis/archive/2010/03/09/explaining-close-wait.aspx

share|improve this answer
1  
Both the client and server app Close() the connection. The main issue is the 1 listening connection for a PID that doesn't seem to exist. Talking with my coworker, the most likely situation is that the server ran out of resources due to running many reports. This is only our best guess though. –  Corey Ogburn Feb 25 '13 at 20:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.