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

socket/fdopen/exec problem

The attached file demonstrates a problem with a
combination of socket, fdopen and exec. It was observed
on Win98/ME/NT4/2000. Latest everything.
Please cc: me directly. 

A server is listening on port 999 and forking worker 
processes. It can be restarted by kill -HUP. Under some 
conditions, new connections stop being accepted and 
netstat -a shows two listen on port 999.

The demo is based on a widely ported program (exim)
where the problem first surfaced. It appears to be related
to the use of fdopen(). 

To reproduce:
1) Compile and run in a window.
2) In another window, 
  a) telnet localhost 999 then quit
  b) kill -HUP pid
  c) netstat -a shows two listen on port 999
     New connections may or may not be accepted, and
     mayhem can occasionally be observed with netstat.

Yes, all sockets are closed. No, playing with the 
"close on exec" bit or with "linger" does not seem
to help.


Attachment: tcpdemo.c
Description: application/unknown-content-type-c_auto_file

Unsubscribe info:
Bug reporting:

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