Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <008701c30386$64cc56c0$5c51893e@pomello>
From: "Max Bowsher" <maxb@ukf.net>
To: "Brian White" <bcwhite@precidia.com>
Cc: <cygwin@cygwin.com>
References: <3E9C374E.4256358D@precidia.com> <004001c30372$9b95d9b0$235e893e@pomello> <3E9C42AF.F8A6AEA1@precidia.com>
Subject: Re: tcp RST instead of FIN if child exits after parent closes path
Date: Tue, 15 Apr 2003 20:36:10 +0100
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

Brian White wrote:
>> [a good analysis, but the subject says it all, really, once a typo is
fixed
>> (s/exists/exits)]
>
> Oops!  :-)
>
>
>> Re: tcp RST instead of FIN if child exits after parent closes path
>>
>> This is a bug/feature of Windows Sockets. I think it would be possible to
>> craft a workaround in Cygwin, but it would require some non-trivial IPC.
>> (IIUC, you would need to maintain a cross-process refcount for the
socket).
>
> Hmmm...  From my work with Amanda, the child process can continue to
> send data via the socket even after the parent has closed it's handle
> on that path, so there must be some sort of reference counting already.

Yes, but the wrong sort.

To guarantee avoiding the RST, you need to shutdown(SHUT_WR) the socket. And
that does stop all processes from writing to the socket. So, you would need
to refcount the socket, and issue a shutdown just before the last close. (I
think.)

For a quick hack, you could try sleeping for a second before exiting. Should
work most of the time.


Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

