delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/11/12:48:54

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=e3/Pkccvloy4uo1CuhQCeuLxtSOZPz3kgvrTsBOOkbPnF7VshHEzT
a0/dc00uDj62o2UJqVmf+ugssGGKC35LYmQYCxJVzDHgCOS41VCePN5FD9oHvGQz
AepRwXjd1mO8xt8DQxIF0g+pO/+WSSXntDtOvd0ruQ6HU6LSwlf1sE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=AolPreBCHSBxPTx40ySznFQLOCw=; b=rbtrDOQku2VnpYZluv+7wbetTlMP
fEul0XLO2DXWsuo6yjZKDHCkxthfbveocl/bDOEMJv6Mc2ft8sDEUTwXMKtz1Cyx
J+jTx0RBpbTqyUVq5Y9Je34Xfce4wxjC2SWXV/OZlzO8qnC7+rknUFPD53u+uSBk
vplJYeq7CZrS07w=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Wed, 11 Mar 2015 17:48:29 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: PTY dies when master in parent process is closed.
Message-ID: <20150311164829.GJ5732@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20150305215323 DOT 760df4752fdbd6f19a931851 AT nifty DOT ne DOT jp> <20150305133100 DOT GY3213 AT calimero DOT vinschen DOT de> <20150305135839 DOT GZ3213 AT calimero DOT vinschen DOT de> <20150306200710 DOT 1264a46aa8dd633943e56212 AT nifty DOT ne DOT jp> <20150308163759 DOT 9d3eacd5f3b168a1515a6bc2 AT nifty DOT ne DOT jp>
MIME-Version: 1.0
In-Reply-To: <20150308163759.9d3eacd5f3b168a1515a6bc2@nifty.ne.jp>
User-Agent: Mutt/1.5.23 (2014-03-12)

--saTAHnV464s+57Yq
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Takashi,

On Mar  8 16:37, Takashi Yano wrote:
> On Fri, 6 Mar 2015 20:07:10 +0900
> Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> wrote:
>=20
> > On Thu, 5 Mar 2015 14:58:39 +0100
> > Corinna Vinschen <corinna-cygwin AT cygwin DOT com> wrote:
> >=20
> > > I applied a patch.  Please have a look.
> >=20
> > I have tested the latest CVS version, and found
> > a new problem.
> >=20
> > With new CVS version, slave side can not detect
> > closure of master.
> >=20
> > Please use following Test Case 3. Test Case 3 is
> > not terminated by itself with latest CVS.
> >=20
> > It seems that the program is stopping at
> > cygwait(input_available_event, time_to_wait)
> > in fhandler_pty_slave::read().
> >=20
> > I guess input_available_event should be set when
> > the last valid master fd is closed.
>=20
> For this problem, I have made a patch.
>=20
> With this patch, it has been confirmed that the problems
> in Test Case 1, 2 and 3 are fixed.
>=20
> I am glad if this would be a help.
>=20
> However, one matter to be concerned is irregular use of
> PeekNamedPipe(). Maybe alternative means could be better
> for detecting closure of all master fds.

I'm inclined to apply this patch.  I think using PeekNamedPipe this way
is pretty nice, albeit it's not atomic.  It might be a good idea to add
an acquire/release_output_mutex bracket, even if that doesn't help for
cases in which a process holding a master fd crashes hard.

Since you suggested it, do you have another idea?

Off the top of my head what we could do:

- Either just set input_available_event always, unconditionally.  But
  that probably requires to change fhandler_pty_slave::read as well.

- Or, use NtQueryObject to fetch the handle count of from_master (see
  flock.cc function get_obj_handle_count()).  If the handle count is
  one, we're the last process holding the handle and then we set
  input_available_event.  But I'm not sure if it's really worth it.  The
  PeekNamedPipe usage looks rather ok to me.

Oh, btw.  Please always add the ChangeLog entries as plain text, not as
diff.  ChangeLog diffs usually don't apply without manual intervention.


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--saTAHnV464s+57Yq
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVAHHdAAoJEPU2Bp2uRE+godUP+wUL6ORA0Os30wRYDKAIBRHj
zBcKwoc+NB/Rp7KvUbSCG6sRlKeIud4U/tgbbT7/rCyJjuklh0m84AD41aKklPqt
BFauFm6/wlgW3ZNDCFv/2FfxWef3KHp5Hpu7bHe4CNjUMxcM+gTJ9G3lQJqvGUy+
zI6IHaQXVYmLVVd7DAJrq98nSlT6GmC1q5y4dMVWL0LU7hnQwRGYJjB7QymaxNbF
Wb1sHidqLK7ObDJtvk2gVUSkOAw9WnCfvukoAeYc1VMWMMPtdZZX1aGQKh2OtbdO
Q72A4qNdWEKn+Da0+jSTtyXyZEblvD1SPCi5trSlRJggp0NvadBa6vsXupN39xAn
mH8ZgmUhLKes1VMEtM5CqtfUk3g3yRTDhLJq0qLng8XDIXUMohwNoK7T9YoSernR
E27lSFBaEpJhKlbEXLESN5DDV81T97schzfvlLUzzw7rYUlQMD1ljLrD47AKpPS5
YLH5h0PytdV6mp6it9BE0K5H7CUEyyGool8ZDA6sWy91cwEtjmAehMjIGs2iOqpy
C9hv53rcoYBNWydgZPEd26MPC9N6HVuYGIHihcSQ01KKEfqPipKjCrXmAcGWw3nB
wuN7qIRuIUzqBdQuao51Rr/QdGHgze4MiR1vZ0DZm6M0N9L5G3bhjXPxRDeHCQhl
y3hDFY7IeNmbJuZbAi9/
=tPG8
-----END PGP SIGNATURE-----

--saTAHnV464s+57Yq--

- Raw text -


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