Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:

share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .