cvs commit: src/sys/netinet in_pcb.c tcp_subr.c tcp_timer.c tcp_var.h

Gleb Smirnoff glebius at
Thu Sep 7 06:03:28 PDT 2006

On Thu, Sep 07, 2006 at 12:18:56AM -0500, Mike Silbersack wrote:
M> >I think we should free the oldmost tcptw entry in a case if we can't
M> >find the local endpoint. We can tell definitely that we can't find one
M> >only in in_pcbbind_setup() in the "do {} while (in_pcblookup_local)" cycle,
M> >where EADDRNOTAVAIL is returned. We can't definitely tell this in
M> >in_pcblookup_local() since we don't know whether tried port is the
M> >last one.
M> >
M> >The oldmost tcptw entry can be taken simply from the ordered list, like
M> >tcp_timer_2msl_tw() does this.
M> That's something along the lines of what I was thinking.  However, I think 
M> it'll be slightly more complex than taking just the oldest entry from the 
M> list.  We could have time_wait states that are for sockets such as 
M> remoteip:ephemeralport <-> localip:80 and also 
M> localip:ephemeralport  <-> remoteip:80.  We'd have to find one of the ones 
M> of the second type to recycle.

It think we need to purge one entry if _we have found a match_ in 
in_pcblookup_local(). And _do not jump_ up to the beginning of the cycle.

M> I think I know why my implementation went so wrong - I was testing the 
M> case where I had http_load (or was it apachebench?) connecting to apache 
M> on another machine.  The case I was trying to solve was where the http 
M> benchmark tool created all the time_wait sockets on the client, thereby 
M> preventing new connections from being made.  In that case, the heuristic 
M> would (probably) recycle the first socket it came upon, and be done.  In 
M> your case, it would recycle the first socket it came upon, but it would be 
M> one of the remoteip:ephemeralport <-> localip:80 sockets, which wouldn't 
M> help it at all.  Does that sound like what was happening?

Probably it does.

Totus tuus, Glebius.

More information about the cvs-src mailing list