Mail Archives: cygwin/2002/01/25/10:38:32
Corinna Vinschen wrote:
>
> Did you set the SO_REUSEADDR flag?
>
Yes.
The background of this is that I am trying to port
an application (exim, a mail transfer agent). I see it does
not answer incoming calls (Win98) after a re-exec following
kill -HUP. I am trying to reproduce the behavior in a
simple demo program. I haven't succeeded yet, but I see
strange things, even on NT. Contrary to what I wrote
yesterday, trouble can occur there too (not all the time).
Consider the following
/> netstat -a | fgrep 999 <=== daemon is running
TCP PHumblet:999 0.0.0.0:0 LISTENING
/> kill -HUP 293 <==== re-exec
/> netstat -a | fgrep 999 <==== only one listen. OK
TCP PHumblet:999 0.0.0.0:0 LISTENING
/> telnet localhost 999
Trying 127.0.0.1...
Connected to PHumblet
Escape character is '^]'.
Hello world <=== OK, daemon is answering
and forking a worker
telnet> quit
Connection closed.
/> netstat -a | fgrep 999
The following is fine. The daemon is listening and the previous
telnet connection is being closed.
TCP PHumblet:999 0.0.0.0:0 LISTENING
TCP PHumblet:999 localhost:2678 CLOSE_WAIT
TCP PHumblet:2678 localhost:999 FIN_WAIT_2
/> kill -HUP 293 <=== HUP the daemon, which reexecs itself
/> netstat -a | fgrep 999
TCP PHumblet:999 0.0.0.0:0 LISTENING
TCP PHumblet:999 0.0.0.0:0 LISTENING
TCP PHumblet:999 localhost:2678 CLOSE_WAIT
TCP PHumblet:2678 localhost:999 FIN_WAIT_2
This is strange. There are now listeners. The only difference with
the first kill -HUP above is that a child process (forked by the
telnet call) is currently running.
/> telnet localhost 999
Trying 127.0.0.1...
Connected to PHumblet
Escape character is '^]'. <= nobody answered
Connection closed by foreign host. <= got this much later, when child exited
This is bad. The incoming call was not answered (no Hello world).
The connection was closed when the child process terminated
and the second listen went away at the same time.
So the child is interfering with the listen of the parent.
After the child exits, things go back to normal. With exim
on Win98, netstat shows that the several listeners stay forever
and incoming calls are never answered...
Any thoughts?
Pierre
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -