On Thu, Dec 13, 2007 at 11:10:51AM +0000, Stuart Henderson wrote: > On 2007/12/13 09:09, Otto Moerbeek wrote: > > It's depening on the application if sockets staying in CLOSE_WAIT are > > a problem or not: it might be intentional (in the hulp duplex case),
Strange typo by me... that's a Dutch word, but not very relevant in this context. It should be half-duplex of course. Stupid autonomous fingers ;-) > > or it might be a program "forgetting" to do a close. > > Does select() notify the application of FIN from the other side? > > If not, that would explain things, it wouldn't be reasonable for > httpd to manually try and receive from all sockets in keepalive > to see whether it needs to close the socket, since it will only > wait KeepAliveTimeout (default 15s) before it closes them anyway. Nice suggestion, but if you've marked the fd for read I would expect select to notify if the other side does a shutdown(SHUT_WR). Other scenarios are also thinkable: like the server socket being blocked because of outgoing data that cannot be written out. That might prevent the server from doing a close too. But in the end the close will happen, otherwise you would run out of fd's very soon. -Otto