From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: GNU make losing jobserver tokens
Date: Fri, 29 Apr 2022 00:01:52 +0900 [thread overview]
Message-ID: <20220429000152.1fe838469e543a69586e194d@nifty.ne.jp> (raw)
In-Reply-To: <YmqgFLRX2ZH8AcpD@calimero.vinschen.de>
On Thu, 28 Apr 2022 16:09:24 +0200
Corinna Vinschen wrote:
> On Apr 28 09:42, Ken Brown wrote:
> > On 4/27/2022 10:13 AM, Takashi Yano wrote:
> > > On Fri, 1 Apr 2022 17:45:51 +0900
> > > Takashi Yano wrote:
> > > > I have tried to reproduce the issue by building OpenJDK
> > > > from source, however, I could not.
> > > >
> > > > Instead, I encountered another issue.
> > > >
> > > > Building OpenJDK sometimes (rarely) failed with error such as:
> > > >
> > > > 0 [sig] make 5484 sig_send: error sending signal 11, pid 5484, pipe handle 0x118, nb 0, packsize 176, Win32 error 0
> > > > 124917 [main] make 5484 sig_send: error sending signal -72, pid 5484, pipe handle 0x118, nb 0, packsize 176, Win32 error 0
> > > > common/modules/GensrcModuleInfo.gmk:77: *** open: /home/yano/jdk/build/windows-x86-server-release/make-support/vardeps/make/common/modules/GensrcModuleInfo.gmk/jdk.accessibility/ALL_MODULES.vardeps: No such file or directory. Stop.
> > > > make[2]: *** [make/Main.gmk:141: jdk.accessibility-gensrc-moduleinfo] Error 2
> > > > make[2]: *** Waiting for unfinished jobs....
> > > >
> > > >
> > > > I looked into this new problem and found that wait_sig() thread
> > > > crashes with segfault. It seems that accessing _main_tls causes
> > > > access violation if a signal is sent just after the process is
> > > > started.
> > > >
> > > > static void WINAPI
> > > > wait_sig (VOID *)
> > > > {
> > > > [...]
> > > > if (!pack.mask)
> > > > {
> > > > tl_entry = cygheap->find_tls (_main_tls);
> > > > dummy_mask = _main_tls->sigmask; // <--- Segfault here
> > > > cygheap->unlock_tls (tl_entry);
> > > > pack.mask = &dummy_mask;
> > > > }
> > > >
> > > > I also found the following patch resolves the issue.
> > > >
> > > > diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
> > > > index 62df96652..3824af199 100644
> > > > --- a/winsup/cygwin/sigproc.cc
> > > > +++ b/winsup/cygwin/sigproc.cc
> > > > @@ -1325,6 +1325,10 @@ wait_sig (VOID *)
> > > > _sig_tls = &_my_tls;
> > > > bool sig_held = false;
> > > > + /* Wait for _main_tls initialization. */
> > > > + while (!cygwin_finished_initializing)
> > > > + Sleep (10);
> > > > +
> > > > sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
> > > > my_readsig, my_sendsig);
> > > >
> > > > I guess _main_tls may not be initialized correctly until
> > > > cygwin_finished_initializing is set.
> > > >
> > > > Any comments would be appreciated.
> >
> > This seems reasonable to me.
Thanks Ken and Corinna.
> Missed that, sorry. I agree this seems reasonable, but wouldn't it be
> cleaner if we *start* wait_sig only after cygwin_finished_initializing
> is set to true?
I also thought so, however, there is a comment in dcrt0.cc
as follows. So, there seems to be some reason to start
wait_sig before cygwin_finished_initialization.
/* Initialize signal processing here, early, in the hopes that the creation
of a thread early in the process will cause more predictability in memory
layout for the main thread. */
if (!dynamically_loaded)
sigproc_init ();
--
Takashi Yano <takashi.yano@nifty.ne.jp>
next prev parent reply other threads:[~2022-04-28 15:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 14:28 Magnus Ihse Bursie
2022-03-21 15:09 ` Ken Brown
2022-03-22 6:54 ` Noel Grandin
2022-03-22 17:52 ` GNU make losing jobserver tokens in pipes Brian Inglis
2022-03-22 19:38 ` checking cyg version (was Re: GNU make losing jobserver tokens) L A Walsh
2022-03-22 21:58 ` Adam Dinwoodie
2022-03-22 23:06 ` Mark Geisert
2022-03-23 17:47 ` Samuel Lelièvre
2022-03-23 6:24 ` GNU make losing jobserver tokens Roumen Petrov
2022-04-01 8:45 ` Takashi Yano
2022-04-27 14:13 ` Takashi Yano
2022-04-28 13:42 ` Ken Brown
2022-04-28 14:09 ` Corinna Vinschen
2022-04-28 15:01 ` Takashi Yano [this message]
2022-04-28 15:32 ` Corinna Vinschen
2022-04-29 9:10 ` Takashi Yano
2022-04-30 21:51 ` Ken Brown
2022-05-01 0:51 ` Takashi Yano
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=20220429000152.1fe838469e543a69586e194d@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--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).