Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jan 2001 20:02:53 -0600
From:      Michael Owens <owensmk@earthlink.net>
To:        hackers@freebsd.org
Subject:   FIN_WAIT_2 / TIME_WAIT Confusion
Message-ID:  <01010820025300.00397@mike>

next in thread | raw e-mail | index | archive | help
If this is not proper place to ask this, let me know and I'll go elsewhere as 
it is a TCP question. . . but I specifically use (and prefer) FreeBSD.

I wrote a simple little I/O multiplexing thing that can act as a client or 
server as a personal project in network programming. Everything seems fine, 
except that when I use the client to make multiple connections to a web 
server.

Even though I don't primarly use it for this, the following behvior has me 
curious.

I will run my client about 2 or three times, each time it makes 5 
connections, pulling back the main page. Then the weird behavior starts:

1. I will get all data back from all connections except for one, perhaps 	    
two, which then sit in a FIN_WAIT_2 or sometimes TIME_WAIT state.

2. When I run netstat -a, it indicates that there is data in the read queue 
for these clients, but select() always returns 0 ready file descriptors. 

That's what puzzles me. There is data there to be gotten, but I am not 
getting it. When I look at the data that comes back in tcpflow, it doesn't 
look like the whole document has made it back either.

A couple of runs might work perfectly, then once or twice will be weird. And 
it seems to multiplex more connections more reliably than fewer (the weird 
behavior seems inversely proportional to the number connections---to a point 
of course. The client runs reliably more times with 50 connections than with 
5).


Three notes:

1. It seems to happen more if I access machines on my LAN than over the 
Internet.

2. I do make sure and shutdown the write side of the socket after I send the 
HTTP request so as to avoid keeping the web server in FIN_WAIT_2.

3. I am sure about having the maxfd + 1 in select() correct, so that's not 
the problem.

Does anyone have any ideas as to what's going on?


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01010820025300.00397>