DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5336uCIg3245193 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 5336uCIg3245193 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=GMXGpdbx X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05932384B80E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1743663372; bh=pxweWKVMaOdvBH0yBATmzXw1Lz/K1n2c9CqeWycNlOE=; 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=GMXGpdbxc6MgK9IONF+duBqNRzJ96GASrycJr6Aek8K7Qn0SO878s7ZIHjk1sLjQm lvjlOhYSxeVN+MdKYwfIid067NVD+MzGkl/1OLbkY4rWn/5ZFZV3Zv4JsB4C94eM7U AEVOlhjXj5KazEQI8FU6KUy++c/K80SAAV2B9xG4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48EAA386583C ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 48EAA386583C ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743663343; cv=none; b=exIgKBq8GUb+s6pBN37jVZcStat9X+YD60r4R9hzMiz3jrgBuMH6qn/fC+AvMgVIiWMJX4VxgwJMk1rVyjzfCOCj0EKGbtNTMh/HbvX6Fn1hOMAP9ewyUnPOKwuziS6A7k+xXuM7+mdSHVeK0yDJmm8tp2PjwyRO+EV49TWGI48= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743663343; c=relaxed/simple; bh=4etqTZr/qVI5cd5wQWD2Q9+F0TbQlpabuosPTgSidiw=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=N2DgBeJccKDHfJ3fsbEWV06T8LIWpHePmx2eDl5/jPgDa4ymzyuLVJXAlJ9rMWJpZZvmfA/BZWfF3rUhke+AQ0qUto0KyXxG+UmDxV407DU9S67BXhWEqrySvWYMQFCiefy3Lc5Fs2CBB1hWqx7OKWx14Egh9K2NzF/qWRIfabw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48EAA386583C Date: Thu, 3 Apr 2025 15:55:38 +0900 To: cygwin AT cygwin DOT com Subject: Re: Crashes in cmake subprocesses since 3.6.0 Message-Id: <20250403155538.0e0b84b6d07cec8e132ef80e@nifty.ne.jp> In-Reply-To: <2e7ccec6-922e-8c96-8d28-52d686d81204@jdrake.com> 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> <20250403144952 DOT ba310b7c6bb82858c489117d AT nifty DOT ne DOT jp> <2e7ccec6-922e-8c96-8d28-52d686d81204 AT jdrake DOT com> 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 Wed, 2 Apr 2025 23:41:46 -0700 (PDT) Jeremy Drake wrote: > 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? Thanks for the suggenstion. That makes sense. I'll submit a fixed version of the patch. -- 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