delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/04/03/02:42:56

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5336gtUr3240384
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 5336gtUr3240384
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=eXo24qhW
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF2D8384AB51
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1743662573;
bh=0VqGqlwiE3VPXx3FcWZLK8USdXN2voi6Z1joHkv1y38=;
h=Date:To:cc:Subject:In-Reply-To:References:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=eXo24qhWQdjKXpnizNtu4lNzBupVL5tBBvVPPhHd5idDohTHwWzJeleAZkm+JEi4h
i/CnGk+Z5VClmV5Ear7z1NlDFHVQLBDTNJGu7u+xCqjhF/oXwil+9DqsoIMFW3RnXW
TijwFvU7sYcJnrEnUrHlwZoObUXj82BUG3gFuN4Q=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CE95384AB7B
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6CE95384AB7B
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743662507; cv=none;
b=m3LqdE059g+/G3oAXt9ldDF1fjrZayVhxk52h41EY1nD4Wa9zPZF0uSstX+YUiNJ2MEFOy4kGq43krJHAWQyWY0zgFQ5aQyNq69zbd5fG66D4QGrVw/bi7hpZak0Y8XZP6Mp53nA7/9HxbYQntZCC6nlzEoUsh+w2ZxMSiADk9Q=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1743662507; c=relaxed/simple;
bh=KBJhRHjrEtBnh5BlgqqY+lTwc/bRG0ZkeISbjy/lTyQ=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=t8aDPwkep918g/YQeTcLvdljRw9S34wzJqgHXjwsZ+DFMFC6fjo1DHPcs63mLkuOHZBEf6i5on6nbz6En59fb2Oi+mVnnN62OtQ4CwsbBZTOiFuLoJ/WyNL1fA7fXyZqApu6nsNw56ac0RFpL52NJzJdysOKvQuYC3ztPG006X8=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CE95384AB7B
Date: Wed, 2 Apr 2025 23:41:46 -0700 (PDT)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
cc: cygwin AT cygwin DOT com
Subject: Re: Crashes in cmake subprocesses since 3.6.0
In-Reply-To: <20250403144952.ba310b7c6bb82858c489117d@nifty.ne.jp>
Message-ID: <2e7ccec6-922e-8c96-8d28-52d686d81204@jdrake.com>
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>
<20250403123235 DOT 027e508e729188197a96ad2d AT nifty DOT ne DOT jp>
<20250403144952 DOT ba310b7c6bb82858c489117d AT nifty DOT ne DOT jp>
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: Jeremy Drake via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Jeremy Drake <cygwin AT jdrake DOT com>
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 Thu, 3 Apr 2025, Takashi Yano via Cygwin wrote:

> 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;

pthread::atforkchild () calls user callbacks, right (pthread_atfork(3))?
Perhaps it should do so after cygwin_finished_initializing is set to
true, in case any functions that the callback might call would be
expecting that?


My encounter with pthread_atfork(3) in the past was an issue in glibc due
to some code that thought it'd be a good idea to mess with atfork handlers
inside an atfork handler.  I can't remember now whether it was registering
a new one, or dlclose-ing a shared library that then caused handlers
registered in that library to be unregistered.  I think the code in
question (in opensc) stopped doing that before glibc got fixed not to
screw up in that scenario.

-- 
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