delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/07/18/10:26:13

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 56IEQCRr2928330
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 56IEQCRr2928330
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=s/P8kf9r
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21DBC385F027
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1752848771;
bh=L9FgspuCAmbLarOGC/ro/bItzTHSXoTjbEWJUpKd0S0=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=s/P8kf9rVV2wSgMSqmgdsZlw0+kTV8Etw/UIktL8c8ApEC3QWtJ3a5MX9SIVVz8uC
0qBameKAQ9iytkOq3NNK9EDrnDf7Isv2tRjeZyh1b6niTwjjaK8US6314vOPA/mWVn
d6zRoJv01ukc3cMiOv7RseY/tkLbQWgsKRffpvhw=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 394E9385E443
Date: Fri, 18 Jul 2025 16:25:49 +0200
To: cygwin AT cygwin DOT com
Subject: Re: Calling system() in multi-threads.
Message-ID: <aHpZbdiHgeRIP1Bk@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20250618203127 DOT 71ac180de11230a9a6055185 AT nifty DOT ne DOT jp>
<20250716235236 DOT 96055ec145d9a0528b50c357 AT nifty DOT ne DOT jp>
<aHfHCqD2xZcdyu7u AT calimero DOT vinschen DOT de>
<20250717231421 DOT 56b54f7e96266311101d4c08 AT nifty DOT ne DOT jp>
<aHkUldQHKjA-lZrw AT calimero DOT vinschen DOT de>
<20250718004446 DOT 9ce9f7f208566ded1a676fd5 AT nifty DOT ne DOT jp>
<20250718012800 DOT 45ae0a80ff8bcd286c176baa AT nifty DOT ne DOT jp>
<aHn9rNKV85wagDCC AT calimero DOT vinschen DOT de>
<20250718213152 DOT d9ca638eab71395709d6f138 AT nifty DOT ne DOT jp>
<20250718223201 DOT 421220a18e7e2f7049634071 AT nifty DOT ne DOT jp>
MIME-Version: 1.0
In-Reply-To: <20250718223201.421220a18e7e2f7049634071@nifty.ne.jp>
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: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin 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 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
> diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
> index cb58b6eed..32f6bdead 100644
> --- a/winsup/cygwin/spawn.cc
> +++ b/winsup/cygwin/spawn.cc
> @@ -944,6 +944,7 @@ spawnve (int mode, const char *path, const char *const *argv,
>    int ret;
>  
>    syscall_printf ("spawnve (%s, %s, %p)", path, argv[0], envp);
> +  child_info_spawn ch_spawn_local;
>  
>    if (!envp)
>      envp = empty_env;
> @@ -961,7 +962,7 @@ spawnve (int mode, const char *path, const char *const *argv,
>      case _P_WAIT:
>      case _P_DETACH:
>      case _P_SYSTEM:
> -      ret = ch_spawn.worker (path, argv, envp, mode);
> +      ret = ch_spawn_local.worker (path, argv, envp, mode);
>        break;
>      default:
>        set_errno (EINVAL);
> 
> 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?  


Corinna

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