unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>, 9767@debbugs.gnu.org
Subject: bug#9767: 24.0.90; gdb initialization on Cygwin
Date: Fri, 21 Oct 2011 16:47:52 -0400	[thread overview]
Message-ID: <4EA1DA78.5060404@cornell.edu> (raw)
In-Reply-To: <4E9F836A.5070505@cornell.edu>

On 10/19/2011 10:11 PM, Ken Brown wrote:
> On 10/19/2011 6:02 PM, Eli Zaretskii wrote:
>>> From: Andreas Schwab<schwab@linux-m68k.org>
>>> Cc: Eli Zaretskii<eliz@gnu.org>, 9767@debbugs.gnu.org
>>> Date: Wed, 19 Oct 2011 23:03:23 +0200
>>>
>>> Ken Brown<kbrown@cornell.edu> writes:
>>>
>>>> No, wait_reading_process_output treats EINTR as though it meant
>>>> there's no
>>>> input available.
>>>
>>> Which is correct because an interrupted select does not report anything.
>>> And then the loop will be restarted to call select again.
>>
>> Yes, that's what I thought should be happening. Sorry if that was
>> unclear.
>
> You were clear. I was the one who muddied the waters by misreading the
> code, and Andreas correctly pointed out that I was wrong.
>
>> So the question is still why no input is being reported, although
>> wait_reading_process_output should loop and call `select' again.
>
> Yes, that's the question. I'll have to go back to my debugging.

OK, I figured out what's happening, and it is related to SIGALRM after 
all.  In line 4406 of process.c, wait_reading_process_output reduces the 
timeout for the select call (under certain circumstances) in an attempt 
to prevent select from being interrupted by SIGALRM.  This seems to me 
to be inherently unreliable, and, in particular, it consistently fails 
on Cygwin.  In other words, the SIGALRM is delivered before select times 
out, causing select to get interrupted.  So wait_reading_process_output 
does indeed loop, and select fails every time (except when a key is 
pressed).

If I block SIGALRM before the call to select (in the situation where the 
timeout was reduced), the problem is solved.  I need to do some more 
testing, but so far I don't see any sign that this causes other problems.

One tricky thing is that blocking SIGALRM has to be done right before 
the call to the *system* select.  In the build with GTK support, this 
call is inside xg_select, and things break if SIGALRM is blocked before 
the call to xg_select.  So I'm not sure what's the best way to handle 
this.  I'll keep thinking about it, but suggestions are welcome.

Ken





  reply	other threads:[~2011-10-21 20:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16 16:02 bug#9767: 24.0.90; gdb initialization on Cygwin Ken Brown
2011-10-16 23:08 ` Ken Brown
2011-10-17  5:39   ` Eli Zaretskii
2011-10-19 20:00     ` Ken Brown
2011-10-19 20:26       ` Eli Zaretskii
2011-10-19 20:43         ` Ken Brown
2011-10-19 21:03           ` Andreas Schwab
2011-10-19 22:02             ` Eli Zaretskii
2011-10-20  2:11               ` Ken Brown
2011-10-21 20:47                 ` Ken Brown [this message]
2011-10-21 22:15                   ` Eli Zaretskii
2011-10-22  9:51                     ` Ken Brown
2011-10-22 20:58                       ` Ken Brown
2011-10-23 21:59                         ` Ken Brown
2011-10-21 22:24                   ` Stefan Monnier
2011-10-22  9:47                     ` Ken Brown

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4EA1DA78.5060404@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=9767@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=schwab@linux-m68k.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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