www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/07/16/10:45:37

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 56GEjb3Z3146239
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 56GEjb3Z3146239
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=k+6mfN+M
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 536333858406
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1752677136;
bh=JscqNA/i7efJczL3nermGphgvoU8ZrVYMJwYsQwaomc=;
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=k+6mfN+M8ln07s1w9RrbTmNbx6xeyZl17/oUUo7I55KLXmLz4nZmTYbniCC4B1QYS
2QgeXg8IxAZvjyvVEtLt4AbXmYL9Z2bPGOyvTgtlyVzeUOzC1AsKzngoM5mYgSGoFC
s9NvsVRDmhrxSb3QyAfGmHuksa8jRoRBygyVvIgs=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 808BB3858402
Date: Wed, 16 Jul 2025 16:44:34 +0200
To: cygwin AT cygwin DOT com
Subject: Re: doxygen hangs when many call graphs are generated.
Message-ID: <aHe60g28H_pTjVux@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20250617214647 DOT ed6f64d44a665820a3fbd1b9 AT nifty DOT ne DOT jp>
<20250716211359 DOT 8f40e5248fe69b9033cba081 AT nifty DOT ne DOT jp>
<20250716213604 DOT 539ada3b63feb7c9e5c3ab05 AT nifty DOT ne DOT jp>
<20250716224532 DOT 311e0e5542d8f5c546bc3ce5 AT nifty DOT ne DOT jp>
MIME-Version: 1.0
In-Reply-To: <20250716224532.311e0e5542d8f5c546bc3ce5@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 16 22:45, Takashi Yano via Cygwin wrote:
> On Wed, 16 Jul 2025 21:36:04 +0900
> Takashi Yano via Cygwin <cygwin AT cygwin DOT com> wrote:
> > On Wed, 16 Jul 2025 21:13:59 +0900
> > Takashi Yano via Cygwin <cygwin AT cygwin DOT com> wrote:
> > 
> > > On Tue, 17 Jun 2025 21:46:47 +0900
> > > Takashi Yano wrote:
> > > > I encountered a problem of doxygen when many call graphs are generated.
> > > > 
> > > > How to reproduce:
> > > > 1) Make a empty directory.
> > > > 2) Place two files (Doxyfile, x.c) attached in the directory.
> > > > 3) Run doxygen in the directory.
> > > > 
> > > > It seems that this is a bug of cygwin1.dll and the cause is
> > > > a deadlock in newlib/libc/stdio/findfp.c:__fp_lock_all().
> 
> A simple reproducer is as follows.
> 
> #include <unistd.h>
> #include <stdio.h>
> #include <pthread.h>
> #include <sys/wait.h>
> 
> void *func(void *arg)
> {
> 	while (1) {
> 		FILE *f = fopen("/usr/bin/cygwin1.dll", "r"); /* Open something */
> 		fclose(f);
> 	}
> 	return NULL;
> }
> 
> int main()
> {
> 	pthread_t th;
> 	pthread_create(&th, NULL, func, NULL);
> 	int cnt = 0;
> 	while (1) {
> 		if (fork() == 0) {
> 			return 0;
> 		} else {
> 			wait(NULL);
> 			printf("Done %d\n", cnt++);
> 		}
> 	}
> }

It's a deadlock on __sfp_recursive_mutex.  fclose() locks the
file via _flockfile() and then calls __sfp_lock_acquire() before
calling _funlockfile(), while __fp_lock_all() called from fork()
first calls __sfp_lock_acquire() and then tries to lock all files
via _flockfile().

It's really a classic case of dumb locking in newlib.

No idea how to fix this yet, though...


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