public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Takashi Yano <takashi.yano@nifty.ne.jp>
Cc: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] TEST: Cygwin 3.1.0-0.1
Date: Thu, 15 Aug 2019 07:49:00 -0000	[thread overview]
Message-ID: <20190815074930.GF11632@calimero.vinschen.de> (raw)
In-Reply-To: <20190815042126.7c2f0baf57b4a82f7d013f74@nifty.ne.jp>

[-- Attachment #1: Type: text/plain, Size: 2394 bytes --]

On Aug 15 04:21, Takashi Yano wrote:
> On Wed, 14 Aug 2019 15:49:00 +0200
> Corinna Vinschen wrote:
> > The only reason I can see is if sigwait_common() returns EINTR because
> > it was interrupted by an unrelated signal.  This in turn lets the read()
> > call fail with EINTR and that should be expected by the callers, in
> > theory.
> 
> Strangely, this problem also disappears with this patch.
> 
> diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
> index 9cf892801..82ac0674f 100644
> --- a/winsup/cygwin/select.cc
> +++ b/winsup/cygwin/select.cc
> @@ -1869,7 +1869,7 @@ thread_signalfd (void *arg)
>        switch (WaitForSingleObject (si->evt, INFINITE))
>         {
>         case WAIT_OBJECT_0:
> -         tls->signalfd_select_wait = NULL;
> +         //tls->signalfd_select_wait = NULL;
>           event = true;
>           break;
>         default:

The problem with not setting signalfd_select_wait to NULL here is that
only a subsequent read or sigwaitinfo will do, so there's a time
post-select which will reroute the signal wrongly.

> Moreover, this EINTR is not set by sigwait_common() but set by
> select_stuff::wait().
> 
> With following debug print, the message shows:
> 1 [main] script 1082 select_stuff::wait: signal = 20
> script: poll failed: Interrupted system call
> Script done, file is typescript
> 
> however, the signal 20 (SIGCHLD) is registered to signalfd by
> script and should be caught.
> 
> diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
> index 9cf892801..adcc75ad3 100644
> --- a/winsup/cygwin/select.cc
> +++ b/winsup/cygwin/select.cc
> @@ -446,6 +446,7 @@ next_while:;
>          unconditionally, ignoring any SA_RESTART detection by
>          call_signal_handler().  */
>        _my_tls.call_signal_handler ();
> +      system_printf ("signal = %d\n", _my_tls.infodata.si_signo);
>        set_sig_errno (EINTR);
>        res = select_signalled;  /* Cause loop exit in cygwin_select */
>        break;

So the signal is then caught in the wrong spot.  Bummer.

Perhas the entire signalfd_select_wait idea was flawed from the
beginning.  I guess the signalfd implementation needs a restart,
but I only have a week left before I'll be mostly abroad for
a couple of weeks.

Any ideas greatly appreciated.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-08-15  7:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 18:55 Corinna Vinschen
2019-08-11  7:28 ` Thorsten Kampe
2019-08-12 13:01   ` Corinna Vinschen
2019-08-12 19:44     ` Takashi Yano
2019-08-13 22:27       ` Thorsten Kampe
2019-08-13 21:45     ` Thorsten Kampe
2019-08-13 21:51       ` Thorsten Kampe
2019-08-14  7:23         ` Takashi Yano
2019-08-12 13:44 ` Takashi Yano
2019-08-12 15:36   ` Corinna Vinschen
2019-08-13 10:48     ` Corinna Vinschen
2019-08-14 11:41       ` Takashi Yano
2019-08-14 11:47         ` Takashi Yano
2019-08-14 13:49           ` Corinna Vinschen
2019-08-14 19:21             ` Takashi Yano
2019-08-15  7:49               ` Corinna Vinschen [this message]
2019-08-15 10:36                 ` Corinna Vinschen
2019-08-15 15:04                   ` Corinna Vinschen
2019-08-15 15:09                     ` Corinna Vinschen
2019-08-16 14:58                       ` Corinna Vinschen
2019-08-17 16:59                         ` Takashi Yano
2019-08-18 12:07                           ` Corinna Vinschen
2019-08-18 12:08 ` Achim Gratz
2019-08-18 14:29   ` Corinna Vinschen
2019-08-18 14:51     ` Achim Gratz
2019-08-19  8:56       ` Corinna Vinschen

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=20190815074930.GF11632@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=takashi.yano@nifty.ne.jp \
    /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).