DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5335oOLc3218425 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 5335oOLc3218425 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=hE4lrWk8 X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70F47384C003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1743659422; bh=dSx6MEvWc6AaB54LCneMoC0zQgW0dEaUT9DXGn3d1H8=; 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=hE4lrWk8aKh4/toZguGzK0Qv1nTrUfSbvXVavexp68TjN8AAFw+hFsTscsN4cgDPP +yyPCbMbRx1zOql9lX4E+q1ovx02FUj7WeQH+/RNV2HySMxHyejuH9xTvdRjw0xv3p PhvXQgOVjDXi7yg6mXgb4y/QQ6zPTmpuI57FOIco= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABCB9385AC21 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ABCB9385AC21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743659397; cv=none; b=pPf3ywPmnld7CTXG6U4sPGpPQxL6xAq4yHFOTQEPc4bK9DzJbAzLvaOxk3rX+7RHfNBYtDhsKj7esu2ofYoTNwaAzF6NNX07Iske+j8b3CcmBSGl53DbkX86dABYZO/raQm/FQ8oiUodfcpp5pyVq8uLRyVvjSi42hsh0O6f4G0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743659397; c=relaxed/simple; bh=jLLzqAcIFeDLC+eJ1F1e9EoXEQTF30uoSUHTmC67xlk=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=joyEeOXPtDufETbjyud4wJE47HIg8jGA8JafYYXaCNZNYLe059Vsyy3lNMYbP0ZeJQpwL9Brw1y8wHfffoSLzOKRNiUy66KSuA/wlyVGO6zKZjk8m24mQ2bOrj4f9Zvf/iMqLY00dgkZKju8MKg0a85w0gB+2pecRMFQHRLRVRI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABCB9385AC21 Date: Thu, 3 Apr 2025 14:49:52 +0900 To: cygwin AT cygwin DOT com Subject: Re: Crashes in cmake subprocesses since 3.6.0 Message-Id: <20250403144952.ba310b7c6bb82858c489117d@nifty.ne.jp> In-Reply-To: <20250403123235.027e508e729188197a96ad2d@nifty.ne.jp> References: <7eaea471-d453-efc7-19cc-58e0ee187af0 AT jdrake DOT com> <20250402220125 DOT 5d2e1d28cfa37ad934a94ed9 AT nifty DOT ne DOT jp> <20250403015216 DOT 3a3d48efb51820b23856225c AT nifty DOT ne DOT jp> <20250403123235 DOT 027e508e729188197a96ad2d 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Thu, 3 Apr 2025 12:32:35 +0900 Takashi Yano wrote: > > 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? It seems that raw_write() is called before returning from pthread::atforkchild() in fork::child(). Moving _my_tls.fixup_after_fork() before atforkchild() seems to solve the issue. What about: ld_preload (); fixup_hooks_after_fork (); ch.rd_proc_pipe = ch.wr_proc_pipe = NULL; ? Should any of these be before pthread::atforkchild() asl well? I'm now performing a long-run test with the patch: diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 0742ab363..28daf2682 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -187,7 +187,6 @@ frok::child (volatile char * volatile here) ForceCloseHandle1 (fork_info->forker_finished, forker_finished); - pthread::atforkchild (); cygbench ("fork-child"); ld_preload (); fixup_hooks_after_fork (); @@ -196,6 +195,7 @@ frok::child (volatile char * volatile here) rd_proc_pipe that would be an invalid handle. In the case of wr_proc_pipe it would be == my_wr_proc_pipe. Both would be bad. */ ch.rd_proc_pipe = ch.wr_proc_pipe = NULL; + pthread::atforkchild (); CloseHandle (hParent); hParent = NULL; cygwin_finished_initializing = true; -- Takashi Yano -- 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