delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/25/10:38:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3C517C32.BB66DB47@ieee.org>
Date: Fri, 25 Jan 2002 10:39:30 -0500
From: "Pierre A. Humblet" <Pierre DOT Humblet AT ieee DOT org>
X-Mailer: Mozilla 4.73 [en] (WinNT; U)
X-Accept-Language: en,pdf
MIME-Version: 1.0
To: Corinna Vinschen <cygwin AT cygwin DOT com>
Subject: Re: socket/fdopen/exec problem
References: <3C50520B DOT 3239FAC5 AT ieee DOT org> <20020124220339 DOT K11608 AT cygbert DOT vinschen DOT de> <3C5080F8 DOT 4E4B8945 AT ieee DOT org> <20020125105955 DOT P11608 AT cygbert DOT vinschen DOT de>

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019