Re: HAProxy and FreeBSD EADDRINUSE

From: Piotr Rybicki <meritus#innervision.pl>
Date: Tue, 09 Dec 2008 10:52:48 +0100


Hi all, some more informations

from FreeSBD src code (/usr/src/sys/netinet/tcp_usrreq.c) FreeBSD 7.1-PRERELEASE

(...)

/*
        INP_INFO_WLOCK_ASSERT(&tcbinfo);
        INP_WLOCK_ASSERT(inp);

        if (inp->inp_lport == 0) {
                error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
                if (error)
                        return error;
        }

        /*
         * Cannot simply call in_pcbconnect, because there might be an
         * earlier incarnation of this same connection still in
         * TIME_WAIT state, creating an ADDRINUSE error.
         */
        laddr = inp->inp_laddr;
        lport = inp->inp_lport;
        error = in_pcbconnect_setup(inp, nam, &laddr.s_addr, &lport,
            &inp->inp_faddr.s_addr, &inp->inp_fport, &oinp, td->td_ucred);
        if (error && oinp == NULL)
                return error;
        if (oinp)
                return EADDRINUSE;
        inp->inp_laddr = laddr;
        in_pcbrehash(inp);

(...)

According to:
http://www.madore.org/~david/computers/connect-intr.html

And:
http://kerneltrap.org/mailarchive/freebsd-net/2007/11/27/451121

It seems that it's common problem in FreeBSD (at minimum).

Mabe there should be some sort of connect-retry functionality implemented in this area (f.e try 2-3 times)?

Best regards:
Piotr Rybicki Received on 2008/12/09 10:52

This archive was generated by hypermail 2.2.0 : 2008/12/09 11:00 CET