public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andy Koppe <andy.koppe@gmail.com>
To: cygwin@cygwin.com
Subject: Re: mintty: Ctrl-Q does not work?
Date: Fri, 19 Oct 2012 11:26:00 -0000	[thread overview]
Message-ID: <CAHWeT-bQ9BqPsVU0r4h5YB68bA7-rksh2sXtbgk3q_xkAObJ=w@mail.gmail.com> (raw)
In-Reply-To: <20121013153831.GA839@ednor.casa.cgf.cx>

On 13 October 2012 16:38, Christopher Faylor wrote:
> On Sat, Oct 06, 2012 at 05:48:44AM +0100, Andy Koppe wrote:
>>On 25 September 2012 14:32, Ryan Johnson wrote:
>>> On 25/09/2012 6:05 AM, Helmut Karlowski wrote:
>>>>
>>>> I type
>>>>
>>>> cat [some long ascii-file]
>>>>
>>>> then Ctrl-S (output stops), then Ctrl-Q (terminal hangs, can only be
>>>> terminated by closing the window).
>>>>
>>>> Using minty 1.1.2 and  1.7.16(0.262/5/3) 2012-07-20 22:55 i686 Cygwin
>>>>
>>>> Can anybody reproduce this?
>>>>
>>> Confirmed with mintty 1.1.1 and the same version of cygwin (w7-64). FWIW,
>>> doing it with `find .' rather than `cat' works fine.
>>
>>The issue isn't specific to any of mintty, cat or Ctrl+S; for example,
>>I've managed to reproduce it with xterm, hexdump, and just hitting
>>Enter. Any other key that sends a keycode will do too. Ctrl+Q isn't
>>needed for the freeze to happen. In xterm I've even managed it with
>>find, by hitting Enter repeatedly.
>>
>>If you then look at the situation in ps, you'll see something like this:
>>
>>O    3396       1    3396       1472  ?       1004 05:11:07 /usr/bin/xterm
>>O    3528    4460    3528        528  pty3    1004 05:25:01 /usr/bin/cat
>>
>>The interesting bit there is the two 'O's in the first column, which
>>means both processes are waiting to output. I think what's happening
>>is that both of them are trying to write to their side of the
>>underlying pty device, but that those writes are blocking until data
>>is read from the other side of the pty. Result: deadlock. If the cat
>>is killed (possibly with -9, because of its nine lives), the terminal
>>happily continues on its way.
>>
>>So why doesn't this happen more often? Not sure. The speed difference
>>between the client process output and the terminal seems to play a
>>role here. I can only guess that the issue occurs if a buffer in the
>>pty's slave->master pipe overflows and something is written to the
>>master->slave pipe at the same time (which is unbuffered?).
>>
>>I don't understand the pty implementation enough to verify any of
>>that, so cgf would need to comment further. Note besides: I couldn't
>>make this deadlock happen on Ubuntu.
>
> This should work in the latest snapshot.  I added a polling kludge for
> 1.7.17 while I mull over the best way to handle this.

Using snapshot 2012-10-16, I confirmed that Ctrl+S during a long cat
no longer freezes the terminal and that Ctrl+Q

However, I still see the deadlock described above when hitting any
other key that sends something, e.g. just Enter.

Andy

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

  reply	other threads:[~2012-10-19 11:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25 12:10 Helmut Karlowski
2012-09-25 13:32 ` Thomas Wolff
2012-09-25 15:41 ` Ryan Johnson
2012-10-06  4:48   ` Andy Koppe
2012-10-13 15:38     ` Christopher Faylor
2012-10-19 11:26       ` Andy Koppe [this message]
2012-10-19 12:17         ` Corinna Vinschen
2012-10-19 15:00           ` Christopher Faylor
2012-10-21  4:38             ` Andy Koppe
2012-10-21  5:44               ` Christopher Faylor
2012-10-28  6:24                 ` Andy Koppe
2012-10-28 17:17                   ` Helmut Karlowski
2012-10-28 17:32                     ` Christopher Faylor
2012-10-29 12:49                     ` Charles Stepp
2012-10-29 14:34                       ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHWeT-bQ9BqPsVU0r4h5YB68bA7-rksh2sXtbgk3q_xkAObJ=w@mail.gmail.com' \
    --to=andy.koppe@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).