This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Workaround patch for MS CLOSE_WAIT bug


Corinna Vinschen wrote: 

> Your patch looks good.  What I didn't quite get is, how the above
> code now looks like (ideally) when using the new FD_SETCF functionality.
> Could you write a short example?  If inetd (what about sshd?) could
> benefit, I'd like to see how to do it.  

FYI, attached are patches for inetd and sshd. I tested the standalone sshd
and sshd from inetd on Win98. No CLOSE_WAIT.
In addition I let the following loop run > 200 times
 i=0; while true; do i=$(($i +1)); ssh the_server echo $i; done
Without patches it stops after 50 to 83 times and all networking
on the server returns WSAENOBUFS (as reported by others). 

Although only a few lines of code need to be changed in the applications,
it would of course be better if Cygwin itself could take care of the bug
once and for all, as discussed last week.
For example, the bug is probably still active (but can be fixed)
in sshd when using ssh -R xxxxxx
   
The patches are not exactly as I had explained. Shutdown() is apparently
not needed but the socket must (?) be blocking when calling close() for 
the last time. I threw in linger = off (default behavior) just to be on the 
safe side. More testing is needed, but it's useless if Cygwin itself gets
to take care of the issue.

Pierre

Attachment: sshd.c.diff
Description: Text document

Attachment: bsd-cygwin_util.h.diff
Description: Text document

Attachment: bsd-cygwin_util.c.diff
Description: Text document

Attachment: inetd.c.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]