delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/05/21/07:53:40

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:in-reply-to
:references:mime-version:content-type; q=dns; s=default; b=w3uHm
oQXiafJhYTySjg6zD7+ZaTc9gm6IPt2Db90ushhVZr+1GWbblD100PMIv1qcS4tZ
8qQ9w5L5H+couG2zaDMugV8GZ5ck/VRFQkma0HOo6NQG5ne7dICoh2Z2kZPMFfHR
CqRXeNWMvXzlVKhr/qSSODD9hybvGa0UY1fm+w=
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:in-reply-to
:references:mime-version:content-type; s=default; bh=M0UCHrImuQu
VLCcyhmZqYKpXa3w=; b=a8g3MK72AjyZ7hy/tlPhAejo1StV1NDuOkM3eZ05OLq
xj1OfoKhilaMkxXq0t/mbfkD7FNWJ1NP88eeFYhrc9Zip1Jf63Y9FcK6OtWDQAvp
UARBTSzUjfEICZWLsxYtZEXlrmBECvMZy0lVy3768Wo6v9YZFycuaoozFELXRZyM
=
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=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_SORBS_DUL,SPF_PASS autolearn=ham version=3.3.2
X-HELO: conuserg001-v.nifty.com
X-Nifty-SrcIP: [121.93.68.199]
Date: Thu, 21 May 2015 20:53:57 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin-2 process handling
Message-Id: <20150521205357.2c125b3bcaf877d0843b52b1@nifty.ne.jp>
In-Reply-To: <555B7E03.40404@cornell.edu>
References: <1573487218 DOT 1490468 DOT 1431969356192 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <555B6F71 DOT 4040906 AT cornell DOT edu> <555B7E03 DOT 40404 AT cornell DOT edu>
Mime-Version: 1.0
X-IsSubscribed: yes

--Multipart=_Thu__21_May_2015_20_53_57_+0900_.mEEGPyir8ZUOEOQ
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi Ken,

On Tue, 19 May 2015 14:16:35 -0400
Ken Brown wrote:

> OK, I got the bisection to work:
> 
> 32fd5b0fe1548cff79b9868e4e259853c59a44db is the first bad commit
> commit 32fd5b0fe1548cff79b9868e4e259853c59a44db
> Author: Takashi Yano <xxx>
> Date:   Thu Mar 12 15:48:10 2015 +0100
> 
>      Let pty slave detect closure of last master handle
> 
>          * fhandler_tty.cc (fhandler_pty_master::close): Add code to 
> make slave
>          detect closure of master. Fix typo in error message.
> 
> 
> Takashi, can you help?  If not, we'll have to wait for Corinna to get 
> back from vacation.

I was looking into this problem, and found the PeekNamedPipe()
call is blocked in fhandler_pty_master::close() when the problem
occurs.

I had not noticed that, 

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365779(v=vs.85).aspx

says:
> The PeekNamedPipe function can block thread execution the same
> way any I/O function can when called on a synchronous handle in
> a multi-threaded application.

I have made a patch attached to resolve this problem. Please have
a look.

With this patch, NtQueryObject() is used instead of PeekNamedPipe()
to detect closure of the last master handle.

Please refer to the following discussion for more details.
http://cygwin.com/ml/cygwin/2015-03/msg00221.html


ChageLog is as follows.

2015-05-21  Takashi Yano  <takashi DOT yano AT nifty DOT ne DOT jp>

	* fhandler_tty.cc (fhandler_pty_master::close): Use NtQueryObject()
	instead of PeekNamedPipe() to detect closing the last master handle.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

--Multipart=_Thu__21_May_2015_20_53_57_+0900_.mEEGPyir8ZUOEOQ
Content-Type: application/octet-stream;
 name="cygwin.patch.20150521"
Content-Disposition: attachment;
 filename="cygwin.patch.20150521"
Content-Transfer-Encoding: base64

ZGlmZiAtLWdpdCBhL3dpbnN1cC9jeWd3aW4vZmhhbmRsZXJfdHR5LmNjIGIv
d2luc3VwL2N5Z3dpbi9maGFuZGxlcl90dHkuY2MKaW5kZXggZTkxYjNlMy4u
OTViZjQ0NSAxMDA2NDQKLS0tIGEvd2luc3VwL2N5Z3dpbi9maGFuZGxlcl90
dHkuY2MKKysrIGIvd2luc3VwL2N5Z3dpbi9maGFuZGxlcl90dHkuY2MKQEAg
LTEzMDksMTMgKzEzMDksMzcgQEAgZmhhbmRsZXJfcHR5X21hc3Rlcjo6Y2xv
c2UgKCkKIAl9CiAgICAgfQogCisgIEhBTkRMRSBvdXRwdXRfaGFuZGxlX2xv
Y2FsOworICBpZiAoIUR1cGxpY2F0ZUhhbmRsZSAoR2V0Q3VycmVudFByb2Nl
c3MgKCksIGdldF9vdXRwdXRfaGFuZGxlICgpLAorCQkgICAgICAgR2V0Q3Vy
cmVudFByb2Nlc3MgKCksICZvdXRwdXRfaGFuZGxlX2xvY2FsLAorCQkgICAg
ICAgMCwgVFJVRSwgRFVQTElDQVRFX1NBTUVfQUNDRVNTKSkKKyAgICB7Cisg
ICAgICB0ZXJtaW9zX3ByaW50ZiAoIkR1cGxpY2F0ZUhhbmRsZSAob3V0cHV0
X2hhbmRsZSksICVFIik7CisgICAgICBvdXRwdXRfaGFuZGxlX2xvY2FsID0g
TlVMTDsKKyAgICAgIFNldEV2ZW50IChpbnB1dF9hdmFpbGFibGVfZXZlbnQp
OworICAgIH0KKwog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ob3V0cHV0X2hhbmRsZV9sb2NhbCk7CisgICAgfQogCiAgIGlmICgh
Rm9yY2VDbG9zZUhhbmRsZSAoZnJvbV9tYXN0ZXIpKQogICAgIHRlcm1pb3Nf
cHJpbnRmICgiZXJyb3IgY2xvc2luZyBmcm9tX21hc3RlciAlcCwgJUUiLCBm
cm9tX21hc3Rlcik7Cg==


--Multipart=_Thu__21_May_2015_20_53_57_+0900_.mEEGPyir8ZUOEOQ
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--Multipart=_Thu__21_May_2015_20_53_57_+0900_.mEEGPyir8ZUOEOQ--

- Raw text -


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