delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/04/02/12:54:18

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 532GsHdm2892465
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 532GsHdm2892465
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=fFqYEMp3
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D075384B810
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1743612855;
bh=VeRupTJ8RUUF5O3OpVlIhCYsBsWmyTKQqGW24oDyvak=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=fFqYEMp3oENlFktKyyH8svnK3qb7Ru9R1pJBq8lUW53/lgkpusAILyKmiiOx3Y9+3
Ba/kr9jeMzifuqAQ3SMuavZMopw0euGGJQK5UvIfuXbj+PD1r6Khd8XQ/VAOfUCZVI
h1RUcU4B5/C8Zl7mVHYgQNQeIxxNuYAk6q67XhXo=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CAF473858D38
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CAF473858D38
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743612770; cv=none;
b=u8PNpaGucaXxY0W+Csq5zvsGy9snT9M3IfYuAM7q/xCumAZ/giLSlPeWuFbvLCz4PhF+DdntUAGPWE4tq/o8pkvTaFhEMHcqZ5MdC2ZB+uM5QQxEbD0oLpGkY0TG9Nj17amD/dN1+t/crJxC5U1lf+gxYNmWAYt/jqREilZNJ50=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1743612770; c=relaxed/simple;
bh=idhVGUbwSzUZGq8sWr5DzvZkhAZD0dnrXSnTXb/6zLk=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=BBa8Si6DOLtRfincZdqblaYfcm1m9Za9+DlUN7Xnp+RbXJa48QdxjdQW7ztUGvXhmiDXIbJDKhDQsVVpeR493J63aXnXA9+s2gBSGtuVYFOGopzWECEngl0FlGq4/kDVpmhq5BUW/5Ho9AxboBz9MjtXyerY6mOe/2wtCd8oUH4=
ARC-Authentication-Results: i=1; server2.sourceware.org
Date: Thu, 3 Apr 2025 01:52:16 +0900
To: cygwin AT cygwin DOT com
Subject: Re: Crashes in cmake subprocesses since 3.6.0
Message-Id: <20250403015216.3a3d48efb51820b23856225c@nifty.ne.jp>
In-Reply-To: <20250402220125.5d2e1d28cfa37ad934a94ed9@nifty.ne.jp>
References: <CAE6_+UfTZc0UTb29p=WVXsP7p7sMmOfmd6SOLR8SCPScJEXHRA AT mail DOT gmail DOT com>
<7eaea471-d453-efc7-19cc-58e0ee187af0 AT jdrake DOT com>
<Z-pgTDoHXm9ip53T AT calimero DOT vinschen DOT de>
<20250402220125 DOT 5d2e1d28cfa37ad934a94ed9 AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On Wed, 2 Apr 2025 22:01:25 +0900
Takashi Yano via Cygwin <cygwin AT cygwin DOT com> wrote:

> Hi Corinna,
> 
> On Mon, 31 Mar 2025 11:28:44 +0200
> Corinna Vinschen wrote:
> > On Mar 30 22:58, Jeremy Drake via Cygwin wrote:
> > > On Mon, 31 Mar 2025, Christoph Reiter via Cygwin wrote:
> > > 
> > > > Starting with 3.6.0 when cmake calls into make/ninja/gcc there is a chance of
> > > > that failing, for example like this:
> > > >
> > > > CMake Error: Generator: build tool execution failed, command was:
> > > > /usr/bin/cmake.exe -E env VERBOSE=1 /usr/bin/make.exe -f Makefile
> > > > cmTC_c87e2/fast
> > > >
> > > > * Problem starts with cygwin 3.6.0
> > > 
> > > I've also reproduced this with cygwin 3.7.0-0.19.g6c5537c0298e, but it
> > > doesn't reproduce as readily as with cygwin 3.6.0-1.
> > 
> > Yes, I can reproduce fails as well, but I don't see an easy way to
> > debug this.  Your testcase just fails but runs along afterwards.
> > 
> > I'm completely cmake-illiterate, which isn't a great help either.
> > 
> > Two points:
> > 
> > - It's unlikely that this occurs only with 3.6.0-1 and later.  It's more
> >   likely that it occurs on the way from 3.5 to 3.6.  Unfortunately the
> >   remaining 3.6.0 test builds are only going back to patchlevel 429 or
> >   so.
> > 
> >   Any chance one of you could bisect Cygwin and find out which commit
> >   introduced the problem?
> > 
> > - Also, since this seems to affect certain cmake versions only, can the
> >   cmake maintainers help here, perhaps?
> 
> Currently, I am looking into this problem.
> 
> What I noticed so far is:
> * The problem occurs after the commit 7ed9adb356df.
> * This problem is happen when fhandler_fifo_pipe::raw_write() returns
>   error because cygwait(pipe_mtx, timeout) returns WAIT_FAILED. This seems
>   to happen due to invalid _cygtls::signal_arrived handle for some reason.
> * The following patch solves the issue.
> 
> diff --git a/winsup/cygwin/local_includes/cygtls.h b/winsup/cygwin/local_includes/cygtls.h
> index f67e9136c..82a34aeca 100644
> --- a/winsup/cygwin/local_includes/cygtls.h
> +++ b/winsup/cygwin/local_includes/cygtls.h
> @@ -228,6 +228,9 @@ public: /* Do NOT remove this public: line, it's a marker for gentls_offsets. */
>    bool locked ();
>    HANDLE get_signal_arrived (bool wait_for_lock = true)
>    {
> +    DWORD dummy;
> +    if (signal_arrived && !GetHandleInformation (signal_arrived, &dummy))
> +      signal_arrived = NULL;
>      if (!signal_arrived)
>        {
>  	if (wait_for_lock)
> 
> Of course, this is not the right thing to do, but this clarifies that the
> cause is _cygtis::signal_arrived being invalid even though it is not NULL.
> The reason is not quite sure to me.
> 
> Any idea?

The following patch also can solve the issue. The problem seems
to be related to fork().

Perhaps, the timming of calling _cygtls::fixup_after_fork(), that
clears signal_arrived to NULL, might not be appropriate?

diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 0742ab363..793521314 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -446,10 +446,14 @@ frok::parent (volatile char * volatile stack_here)
       impure_beg = _impure_ptr;
       impure_end = _impure_ptr + 1;
     }
+  HANDLE signal_arrived_back;
+  signal_arrived_back = _my_tls.signal_arrived;
+  _my_tls.signal_arrived = NULL;
   rc = child_copy (hchild, true, !*with_forkables,
 		   "stack", stack_here, ch.stackbase,
 		   impure, impure_beg, impure_end,
 		   NULL);
+  _my_tls.signal_arrived = signal_arrived_back;
 
   __malloc_unlock ();
   locked = false;


-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019