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.

Preface (skip for the real problem): I have an application that is listening to port 843. This process is run as root. Sometimes killing the process (with ^C) leaves it hanging for a long time (forever?). Being impatient, I kill it with kill -9. The problem now is that port 843 is still listening, even though there no application there.

Looking at lsof -i shows me no processes listening to 843, even when run as root. Looking at netstat -a, however, shows that it is listening, and even some connections that weren't torn down correctly:

Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp6       0      0  localhost.843          localhost.60927        CLOSE_WAIT
tcp6     386      0  localhost.843          localhost.60926        CLOSE_WAIT
tcp6       0      0  localhost.843          localhost.60925        CLOSE_WAIT
tcp6     386      0  localhost.843          localhost.60924        CLOSE_WAIT
tcp46      0      0  *.843                  *.*                    LISTEN
tcp4       0      0  *.843                  *.*                    LISTEN

A similar question recommends that I don't get into this situation in the first place. That's sound advice, but a bit hard since it's not my application. Furthermore, it would be nice to be get out of it regardless.

Any way I can get out of this mess without rebooting? Is the fact that I ran it as root important? (I only need root to listen to low-numbered ports, for which I didn't find a way without installing software like authbind).

share|improve this question
    
could you please post the output of netstat -lntp|grep 843 –  Serge Feb 27 '13 at 17:43
    
This is on OSX (BSD), so -lntp probably means something other than you want. Specifically, -p takes an argument (protocol). What would the output be? –  Johannes Hoff Feb 27 '13 at 17:49
    
    
Doesn't seem like there is an equivalent of -p in OSX :\ –  Johannes Hoff Feb 27 '13 at 17:54
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.