This is the mail archive of the cygwin-developers@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]

Winsock closesocket() problem


Pierre and I have been working (privately) to solve the exim problem
that I mentioned in the following post:

    http://cygwin.com/ml/cygwin-developers/2003-02/msg00125.html

It appears that under certain conditions Winsock's closesocket() is not
happy closing a socket more than once.  See the attached test case,
sc9.cc, which demonstrates the problem when run under LocalSystem:

    $ sc9
    close(fd2) failed with 108

Note that the problem follows the second close().  If I switch the order
of the close() calls, then dup()-ed socket closes without any errors.
Hence, I don't believe that this problem is directly related to dup().

I have worked around the problem with the attached patch to
fhandler_socket::close().  Is this a reasonable way to solve this
problem?  Or, does anyone have any other suggestions?

BTW, this is YA problem that goes away under strace and gdb, which make
debugging this problem difficult.  Sigh...

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Attachment: sc9.cc
Description: Text document

Attachment: fhandler_socket.cc.diff
Description: Text document


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