X-Recipient: archive-cygwin@delorie.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:content-transfer-encoding;
	 q=dns; s=default; b=obAoGFYn+adFNTOBqSghqmUhbAQWICapyL81OtFA3fa
	6beXa1gcZ/Jh+eZ39bTBE+Flq212QckcjdUZjHwpk4XDF7lUnoT0+GpKRaawBe8K
	jSyUjHPvrIoQ1inDhvnKKdVr+lmPbHYaJ4W/ioM+HRSb/xWIXHZJnzrlc+KduSmk
	=
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:content-transfer-encoding;
	 s=default; bh=/MF6sxMmtL7GbGEraC/vihqHLuk=; b=LS2Zmn37xs2lvEbDq
	fh050jN9aezw9RV3Cvdif/RyE+s72/IIJ69ie95M5n+eOBosfBBY+FiKYFY0V11R
	9vSwcmSqyo1ItLuCd0r1UkHGNoA6H/Qh6IkQYTp4UtCehizUreD413KTN6MRYRys
	iGr8Ju7Oe7Glfujbb91oB/6XxI=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2
X-HELO: conuserg008-v.nifty.com
X-Nifty-SrcIP: [121.93.68.199]
Date: Mon, 2 Mar 2015 20:45:02 +0900
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Cygwin hangs up if several keys are typed during outputting a lot of texts.
Message-Id: <20150302204502.39b3e03ad5084b0b5add5d10@nifty.ne.jp>
In-Reply-To: <20150228140251.GA11124@calimero.vinschen.de>
References: <20150228144019.0e4cfdb3a26bfac361b538e2@nifty.ne.jp>	<20150228140251.GA11124@calimero.vinschen.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On Sat, 28 Feb 2015 15:02:51 +0100
Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:

> Hmm, I can reproduce this even with stty -echo.  The tty code is not

Some shells seem to re-enable echo when it goes back into prompt.
Please put both 'stty' and 'yes' in one command line, separating
them with semi-colon.

> exactly my domain, so I'm not sure at the moment where to look.  I guess
> the locking strategy in the tty code is not robust enough.  Did you have
> a look into the cygwin sources in the meantime, by any chance?

To tell the truth, I have looked into the source code.
I guess the mechanism of blocking is as follows.

1) Buffer of named pipe gets full-filled by a lot of data written
  by slave side.
2) WriteFile() in fhandler_pty_master::doecho(), which is called
  from master side by key input, is blocked because the buffer
  is full.
3) If a handling to read from the pipe is in the same thread as
  key input, the thread falls into deadlock.

To check buffer space before WriteFile() is one idea,
but it is not smart, I suppose...

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

--
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

