Re: connect() returns EADDRINUSE during massive host->host conn rate



Jan Srzednicki wrote:
Hello,

I have a pair of hosts. One of them performs a massive amount of
TCP connections to the other one, all to the same port. This setup
mostly works fine, but from time to time (that varies, from once a
minute to one a half an hour), the connect(2) syscall fails with EADDRINUSE. The connection rate tops to 50 connection

so, what does netstat -aAn show?

initiations/second.

The socket is non-blocking. It does standard job of creating the socket,
setting up the relevant fields, setting SO_REUSEADDR and SO_KEEPALIVE,
setting O_NONBLOCK on the descriptor. No bind(2) is performed. The
connection is initiated from inside a jail (not sure if that implies a
internal bind(2) to the jail's address). There are no connections from
the other host to the first one.

I've tried tuning the net.inet.ip.portrange variables: I've increased
the available portrange to over 45000 ports (quite a lot, should be more
than enough for just anything) and I've toggled
net.inet.ip.portrange.randomized off, but that didn't change anything.

The workaround on the application side - retrying on EADDRINUSE - works
pretty well, but hey, from what I know from the Stevens book, that
shouldn't be happening, though Google said all BSD had a bad habit of
throwing out EADDRINUSE from time to time.

This all happens on a 6.2-RELEASE system. The symptoms are easily
reproducable in my environment.

Is there any known fix for that? If there ain't, can it be fixed? :)


_______________________________________________
freebsd-net@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • HSRP on multilayer switches
    ... Connected to each end of this gigaman are Catalyst ... With the MAN connection, these hosts appear ... The hosts don't run OSPF, though they can run RIPv2 and we could ...
    (comp.dcom.sys.cisco)
  • Jezebel will generate them.
    ... It can powerfully absorb frightened and hosts our strict, ... The occasion ... Well Osama will flow the suicide, and if Basksh hourly crys it too, the ... fun in connection with Tariq's covenant. ...
    (sci.crypt)
  • Re: Design question
    ... a message is sent (via TCP connection) to every other hosts ... > complexity, synchronization lag, ... I like your "server" approach. ...
    (microsoft.public.win32.programmer.networks)
  • Re: Unable to connect to HP-UX 11.11 via eXceed 7.1
    ... # The above entry allows the following hosts to attempt to access your ... The inetd.sec file is for daemons started by inetd, and your X connection is ... X and b) you modify the correct files to allow X connections. ... Unix Guy Consulting, LLC ...
    (comp.sys.hp.hpux)
  • Re: Design question
    ... a message is sent (via TCP connection) to every other hosts ... synchronization lag, ... For failover you can introduce 2 or more servers: ...
    (microsoft.public.win32.programmer.networks)