delorie.com/archives/browse.cgi | search |
DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 5333XDxO3153762 |
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 5333XDxO3153762 |
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=BvQXTWWO | |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org B0E1D384C2C4 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1743651191; | |
bh=O5y8kmcnZqZ7ucUJRS3ghqvM+5tNhYq7blcpQtpTycs=; | |
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=BvQXTWWO5xNnVE9UOQNFM00SjBU0dtlVdhwGcwheA1e9YXjrGF6igcRUky5UbNK92 | |
TqG6uOfQqDfUsd6B8dtHjGojILQs5jcKFr7Mrs9vCIl3vYdl+Le/mw0YVygJwuTUIh | |
h9+yL6ORi+VcWbSXUB8VuBC3DwrWQWCr7kA0dfaM= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 41C1B384D176 |
ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org 41C1B384D176 |
ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743651163; cv=none; |
b=bfXzntnSCzrD47/zR309ml1dA4fgB+I0tUNXxB8TUfzuN4FKi3mTfQ1KyulQPlgMeLG0ac9j421J3o4lhGGaDL3pss3TIiYcFnQQ1Gs0ehiitDRhBOJFVWEqQWqPLpaLFcUUpy/qBiIBciWgnITLjlmNukmO1dvsmQhGc8L2trw= | |
ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
t=1743651163; c=relaxed/simple; | |
bh=cIdMWyJlpLVMMvlU28CONpFAwu0SdjpudaPW5zI2jIY=; | |
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; | |
b=Z0xqksmxMPZE7pcJVI6gwhoV4npIzCbjYQGHouGac3/Y3cVIdtOvG01Di88lMrFdFybbiHX+M4jq4IWo9QhkKeLoUC40QTKdi47/qB7QmF1SFqgHoLDxk4vT/ZRJIgsquV6QcKC5P8XmltP08/Q0a8ihB+CUvdW8v65KBjQzYCM= | |
ARC-Authentication-Results: | i=1; server2.sourceware.org |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 41C1B384D176 |
Date: | Thu, 3 Apr 2025 12:32:35 +0900 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Crashes in cmake subprocesses since 3.6.0 |
Message-Id: | <20250403123235.027e508e729188197a96ad2d@nifty.ne.jp> |
In-Reply-To: | <Z-1-2raM0AN8aSqD@calimero.vinschen.de> |
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> | |
<20250403015216 DOT 3a3d48efb51820b23856225c AT nifty DOT ne DOT jp> | |
<Z-1-2raM0AN8aSqD AT calimero DOT vinschen DOT de> | |
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 20:15:54 +0200 Corinna Vinschen wrote: > Hi Takashi, > > On Apr 3 01:52, Takashi Yano via Cygwin wrote: > > > 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(). > > So the invalid signal_arrived occurs in the child? Yes. > > Perhaps, the timming of calling _cygtls::fixup_after_fork(), that > > clears signal_arrived to NULL, might not be appropriate? > > _cygtls::fixup_after_fork() is called in the middle of fork in the > child. No other thread should be running in the child at the time. > How's it possible that a raw_write is running? > > > 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; > > Weird. But if that helps, wouldn't it make sense to keep > _my_tls.signal_arrived at the same value in the parent (signal handling > shouldn't run anyway at that time) and just set _my_tls.signal_arrived > in the child to NULL after child_copy()? > > I.e. > > rc = child_copy (...); > WriteProcessMemory (hchild, (PVOID) &_my_tls.signal_arrived, > &null_ptr, sizeof null_ptr, NULL); This does not work (ERROR_PARTIAL_COPY), however, the following works. diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 0742ab363..e11a7d507 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -450,10 +450,15 @@ frok::parent (volatile char * volatile stack_here) "stack", stack_here, ch.stackbase, impure, impure_beg, impure_end, NULL); + SIZE_T nb; + _cygtls tls1; + tls1 = _my_tls; + tls1.signal_arrived = NULL; + WriteProcessMemory (hchild, (PVOID) &_my_tls, &tls1, sizeof (tls1), &nb); __malloc_unlock (); locked = false; - if (!rc) + if (!rc || nb != sizeof (tls1)) { this_errno = get_errno (); error ("pid %u, exitval %p", pi.dwProcessId, ch.exit_code); > Still, I wonder in which thread raw_write is running during fork(). Weird enough, raw_write() is called in the main thread (_main_tls). Any chance, fixup_after_fork() is not called? -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |