[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Solving "Address already in use"



On Fri, Feb 06, 2004 at 03:34:04PM -0800, Joe Emenaker wrote:
> Here's a wierd one.
> 
> Our SpamAssassin daemon crashed and, when I tried to restart it, I
> got:
> 
>  Could not create INET socket: Address already in use
> IO::Socket::INET: Address already in use
> 
> ... and I can't find any running spamd, so it looks like it's a stuck
> socket.
> 
> I haven't seen one of these for a long time but, in the past, we'd
> have to reboot the machine in order to fix it.
> 
> Is there a better way, these days? Can I forcibly "un-use" the port?
> If not, can I, at the least, find out what process ID's the kernel
> thinks have it open?

It will time out after a while.  To prevent it happening again, find out
how to get perl to call setsockopt with the SO_REUSEADDR option.

A quick look at "perldoc IO::Socket::INET" reveals:

           In addition to the key-value pairs accepted by IO::Socket,
           "IO::Socket::INET" provides.
           [...]
               ReuseAddr   Set SO_REUSEADDR before binding
           [...]

I am not at all familiar with the SpamAssassin code, but see if you can
figure out where to add in the "ReuseAddr => 1" option, if it's not
there already.

If it is there already, I don't know what the problem is.

-- 
Michael Wood <mwood@its.uct.ac.za>



Reply to: