DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 56IF5GZc2981411 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 56IF5GZc2981411 X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A881D385EC3F ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A881D385EC3F ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752851100; cv=none; b=tOUrQC45/kfdsoBlsnDgTgMfWY1+50j/RcTc75N6n7i5FRdrgWsvIlyPdppOfwpZGwyC9q6HwWtHrrV+lfs1VfGOxHttu1L3U0odxxJuoSm3QhJAor0AsYiYLVc4dxP7aaoldXivWI8+pFAYat7jQebK0zLBfkp4BsKo8oFqWpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752851100; c=relaxed/simple; bh=+8Wm7HoS6ebwy0btQb7OTJKymUYEIfUl2slKaelhQ/U=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=liNGFgwEynxNK6IXrmt+tJxY0qbPiKMCMJpUzYPI44eldqRJ2Db9wE2YSfN2Inl0WIsq9bjiO35L1iFTRUXtrdplbUae12YUDKkpOGd6Wy0vFL6kYkWkruxrJPBKUMaqN86d//tVEfbVWzsBGZ2KxPV4JeWsV3H3t8U/hryAKL4= ARC-Authentication-Results: i=1; server2.sourceware.org Date: Sat, 19 Jul 2025 00:04:56 +0900 To: cygwin AT cygwin DOT com Subject: Re: Calling system() in multi-threads. Message-Id: <20250719000456.61a9c7d3e56269bb75b7e539@nifty.ne.jp> In-Reply-To: References: <20250618203127 DOT 71ac180de11230a9a6055185 AT nifty DOT ne DOT jp> <20250716235236 DOT 96055ec145d9a0528b50c357 AT nifty DOT ne DOT jp> <20250717231421 DOT 56b54f7e96266311101d4c08 AT nifty DOT ne DOT jp> <20250718004446 DOT 9ce9f7f208566ded1a676fd5 AT nifty DOT ne DOT jp> <20250718012800 DOT 45ae0a80ff8bcd286c176baa AT nifty DOT ne DOT jp> <20250718213152 DOT d9ca638eab71395709d6f138 AT nifty DOT ne DOT jp> <20250718223201 DOT 421220a18e7e2f7049634071 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 Fri, 18 Jul 2025 16:25:49 +0200 Corinna Vinschen wrote: > On Jul 18 22:32, Takashi Yano via Cygwin wrote: > > I embedded debug code into mm/cygheap.cc, that is: > > > > diff --git a/winsup/cygwin/mm/cygheap.cc b/winsup/cygwin/mm/cygheap.cc > > index 338886468..bab4067e0 100644 > > --- a/winsup/cygwin/mm/cygheap.cc > > +++ b/winsup/cygwin/mm/cygheap.cc > > @@ -371,7 +371,16 @@ _cmalloc (unsigned size) > > if (cygheap->buckets[b]) > > { > > rvc = (_cmalloc_entry *) cygheap->buckets[b]; > > - cygheap->buckets[b] = rvc->ptr; > > + __try > > + { > > + cygheap->buckets[b] = rvc->ptr; > > + } > > + __except (NO_ERROR) > > + { /* Shouldl not reach */ > > + system_printf("b = %d", b); > > + assert (false); > > + } > > + __endtry > > rvc->b = b; > > } > > else > > The result is like this! Why??? > > > > 0 [main] sh 617 _cmalloc: b = 1 > > assertion "false" failed: file "../../.././winsup/cygwin/mm/cygheap.cc", line 381, function: void* _cmalloc(unsigned int) > > I don't know. Looks like rvc points into nirvana. Who's the caller? > what's the value of cygheap->buckets[1]? Is something filling up cygheap > fast, perhaps? 0 [main] sh 403 _cmalloc: b = 0 164 [main] sh 403 _cmalloc: cygheap->buckets[b] = 0x63005C003A0043 0 [main] sh 405 _cmalloc: b = 0 0 [main] sh 408 _cmalloc: b = 0 164 [main] sh 405 _cmalloc: cygheap->buckets[b] = 0x6 0 [main] sh 407 _cmalloc: b = 0 166 [main] sh 408 _cmalloc: cygheap->buckets[b] = 0x6 218 [main] sh 407 _cmalloc: cygheap->buckets[b] = 0x6 0 [main] sh 404 _cmalloc: b = 0 167 [main] sh 404 _cmalloc: cygheap->buckets[b] = 0x6 0 [main] sh 409 _cmalloc: b = 0 131 [main] sh 409 _cmalloc: cygheap->buckets[b] = 0x6 1 [main] sh 406 _cmalloc: b = 0 172 [main] sh 406 _cmalloc: cygheap->buckets[b] = 0x6 cygheap->buckets[b] seems to be broken. 403: ... (infinite loop for ritrieving stacktrace) ... #2 0x00007fff8bd36ad8 in _cmalloc (size=) at ../../.././winsup/cygwin/mm/cygheap.cc:382 #3 0x00007fff8bd37418 in cmalloc (fn=0x0, n=9, x=HEAP_STR) at ../../.././winsup/cygwin/mm/cygheap.cc:476 #4 cmalloc (n=9, x=HEAP_STR) at ../../.././winsup/cygwin/mm/cygheap.cc:483 #5 crealloc (fn=0x7fff8beb5984 "crealloc", n=9, s=) at ../../.././winsup/cygwin/mm/cygheap.cc:496 #6 crealloc_abort (s=, n=9) at ../../.././winsup/cygwin/mm/cygheap.cc:514 #7 0x00007fff8bc55fd6 in path_conv::set_posix (path_copy=0x1210720 "/dev/tty", this=0x7ffffc800) at ../../.././winsup/cygwin/path.cc:451 #8 path_conv::set_posix (path_copy=0x1210720 "/dev/tty", this=0x7ffffc800) at ../../.././winsup/cygwin/path.cc:446 #9 path_conv::check (this=this AT entry=0x7ffffc800, src=, src AT entry=0x0, opt=6817, suffixes=0x7fff8bf2d1c0 ) at ../../.././winsup/cygwin/path.cc:1310 #10 0x00007fff8bc1959c in path_conv::path_conv (suffixes=, opt=6817, src=0x0, this=0x7ffffc800) at /home/yano/newlib-cygwin/winsup/cygwin/local_includes/path.h:312 #11 build_fh_name (name=name AT entry=0x10049d830 "/dev/tty", opt=opt AT entry=6657, si=) at ../../.././winsup/cygwin/dtable.cc:439 #12 0x00007fff8bc92f7a in open (unix_path=0x10049d830 "/dev/tty", flags=16386) at ../../.././winsup/cygwin/syscalls.cc:1488 #13 0x00007fff8bd5a1c4 in _sigfe () at sigfe.s:35 #14 0x000000010040dee5 in check_dev_tty () #15 0x00000001004948f1 in main () 405: ... (infinite loop for ritrieving stacktrace) ... #2 0x00007fff8bd36ad8 in _cmalloc (size=) at ../../.././winsup/cygwin/mm/cygheap.cc:382 #3 0x00007fff8bd37418 in cmalloc (fn=0x0, n=9, x=HEAP_STR) at ../../.././winsup/cygwin/mm/cygheap.cc:476 #4 cmalloc (n=9, x=HEAP_STR) at ../../.././winsup/cygwin/mm/cygheap.cc:483 #5 crealloc (fn=0x7fff8beb5984 "crealloc", n=9, s=) at ../../.././winsup/cygwin/mm/cygheap.cc:496 #6 crealloc_abort (s=, n=9) at ../../.././winsup/cygwin/mm/cygheap.cc:514 #7 0x00007fff8bc55fd6 in path_conv::set_posix (path_copy=0x1390720 "/dev/tty", this=0x7ffffc800) at ../../.././winsup/cygwin/path.cc:451 #8 path_conv::set_posix (path_copy=0x1390720 "/dev/tty", this=0x7ffffc800) at ../../.././winsup/cygwin/path.cc:446 #9 path_conv::check (this=this AT entry=0x7ffffc800, src=, src AT entry=0x0, opt=6817, suffixes=0x7fff8bf2d1c0 ) at ../../.././winsup/cygwin/path.cc:1310 #10 0x00007fff8bc1959c in path_conv::path_conv (suffixes=, opt=6817, src=0x0, this=0x7ffffc800) at /home/yano/newlib-cygwin/winsup/cygwin/local_includes/path.h:312 #11 build_fh_name (name=name AT entry=0x10049d830 "/dev/tty", opt=opt AT entry=6657, si=) at ../../.././winsup/cygwin/dtable.cc:439 #12 0x00007fff8bc92f7a in open (unix_path=0x10049d830 "/dev/tty", flags=16386) at ../../.././winsup/cygwin/syscalls.cc:1488 #13 0x00007fff8bd5a1c4 in _sigfe () at sigfe.s:35 #14 0x000000010040dee5 in check_dev_tty () #15 0x00000001004948f1 in main () -- 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