Summary: socket bind (address in use)

From: Charlie Taylor (
Date: Tue Nov 05 1991 - 10:59:16 CST

Lot's of interest on this one...

Seems that many people have experienced similar difficulties but suggested
that _if_ I would be patient the port would eventually clear. However, I
don't think that is the case if there is a host out there somewhere with
a process trying to connect to it. Anyway, I waited more than 24 hrs which
is long enough for me!

It was also suggested that I should use the most "gentle" means available
(avoid kill -9) for killing these processes so that they have the opportunity
to clean up after themselves. I think this is useful in the case of lpd but
in the case of the license managers, they were dying their own death so there
wasn't much I could do about it.

The most pro-active solution came from Matt Crawford (
who wrote...

There is another way. How brave are you?

Use "netstat -A -f inet" and find the PCB address of the connection
which offendeth thee. This is the address of a "struct tcpcb" (see
<netinet/tcp_var.h>) What you want to do is use "adb -w /vmunix
/dev/kmem" to zero out the "state" variable. (State 0 is "CLOSED")

Suppose I want to zap the last connection listed here:

# netstat -A -f inet
Active Internet connections
PCB Proto Recv-Q Send-Q Local Address Foreign Address (state)
ff64c18c tcp 0 0 localhost.3738 localhost.sunrpc TIME_WAIT
ff659b0c tcp 0 0 localhost.3737 localhost.sunrpc TIME_WAIT
ff65308c tcp 0 240 group-w.3730 hepterm1.6000 ESTABLISHED
ff65ad0c tcp 0 0 group-w.1023 oddjob.login ESTABLISHED
ff65400c tcp 0 0 group-w.3726 hepterm1.6000 ESTABLISHED
ff65658c tcp 0 0 group-w.3725 oddjob.6667 ESTABLISHED
# adb /vmunix /dev/kmem
not core file = /dev/kmem
0xff656594: 4
./w 0

Then wait several seconds for the periodic TCP scanning of PCB's to
eliminate that connection entirely.
Matt Crawford Astronomy & Astrophysics U of Chicago

I have not had the opportunity to try this yet so I can't vouch for it.
It may sound a little drastic but that's part of the fun if you can
afford the gamble!

As usual, thanks for all the replies,

Charlie Taylor
UF Astronomy

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:17 CDT