From owner-freebsd-hackers Mon Jan 8 18:43:52 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from VL-MS-MR002.sc1.videotron.ca (relais.videotron.ca [24.201.245.36]) by hub.freebsd.org (Postfix) with ESMTP id BD75037B401 for ; Mon, 8 Jan 2001 18:43:32 -0800 (PST) Received: from jehovah ([24.202.203.37]) by VL-MS-MR002.sc1.videotron.ca (Netscape Messaging Server 4.15) with SMTP id G6VJKJ01.7Q3; Mon, 8 Jan 2001 21:43:31 -0500 Message-ID: <003b01c079e6$2303bb60$25cbca18@jehovah> From: "Bosko Milekic" To: , References: <01010820025300.00397@mike> Subject: Re: FIN_WAIT_2 / TIME_WAIT Confusion Date: Mon, 8 Jan 2001 21:44:49 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi Michael, What version of FreeBSD are you running? If it's not too much trouble, can you please provide the code you're using to simulate the problem? Are the TIME_WAIT state connections eventually timing out/disappearing? Michael wrote: > 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