delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2026/07/15/08:59:07

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 66FCx6Bx1181384
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 66FCx6Bx1181384
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=XnAhK6Ha
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 368DB4BA2E17
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1784120344;
bh=9ZixCaBfNKBKdGFY9smC/7TsUDQIGp89ToVTB22fAUw=;
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=XnAhK6HaCD7C+SknODuc8QmInj42F2QqBx3cMAmUYfyESM4qcVrB4/XNlU7aBby+t
nhw0tkUJz8QKavhLdA6MWIIj2EZe3RNdHfAfqawwbVo3nLyHiYyOv0Tu2HJytlU2Tl
fmnnDsRaYem9C8TJV9m46y1B7t1t9RmkyvNMqSXw=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50DA04BA5435
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 50DA04BA5435
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784120319; cv=none;
b=W9UOMerSKQHrG1T0HkUOxvcBkt5xqDDVSD6GrovZJvTBqCLvEmhrXblC02edYR5xDc9Tbxw7pevNzyo0jbS0YyEoiZv9mCDHfwcmMPkQ/RB9P6nlYbo7S9z4k3fF2dXu90S3docPk+N6Br7uxdY0ofcZmgjvFB1nRoRyZ61cwUg=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1784120319; c=relaxed/simple;
bh=e1uudnngtEP7mwT9Rd90l5YJUQdk7X/0ImZiD/BgRAY=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=pcnbMhYwVjWprPipJNIH9vCfKeKukMfDWWTIbkeke4Zx/f9Brvev5LzBImsp1XzYNz7QExq9ZBfkVyk9F+R4VwgaMbI9IWlSv84ajetYp1CQj78Ko6W+PKMj46EQJCubJQv56MSRuyQi3udm/J6gU7P2OCLm/gbe4oyGobxVRtM=
ARC-Authentication-Results: i=1; sourceware.org;
dkim=pass (2048-bit key, unprotected)
header.d=nifty.ne.jp header.i=@nifty.ne.jp header.a=rsa-sha256
header.s=default-1th84yt82rvi header.b=JE08Gh1i
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50DA04BA5435
Date: Wed, 15 Jul 2026 21:58:35 +0900
To: cygwin AT cygwin DOT com
Subject: Re: Opening a fifo causes a deadlock on Cygwin 3.6.10
Message-Id: <20260715215835.53868d842d099da2bb7debef@nifty.ne.jp>
In-Reply-To: <1784112120924.242086950.3079110@ezweb.ne.jp>
References: <1784112120924 DOT 242086950 DOT 3079110 AT ezweb 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
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: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
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 Wed, 15 Jul 2026 11:20:29 +0000
kikairoya wrote:
> Hello,
> 
> After upgrading to Cygwin 3.6.10, opening a fifo endpoint causes a 
> deadlock.
> (Found in the LLVM testsuite, 
> llvm/unittests/Analysis/MLModelRunnerTest.cpp: 
> InteractiveModelRunner::Evaluation).
> 
> 
> reproducer:
> 
> $ gcc fifotest.c && ./a
> trying to open /tmp/thetestfifo.pipe for write
> trying to open /tmp/thetestfifo.pipe for read
> (hangs here, and some of runs ignore Ctrl+C)
> 
> Opening a fifo is blocked correctly until another endpoint is opened.
> However, Cygwin 3.6.10 never returns, even after both endpoints are 
> requested to be opened.
> 
> Downgrading to Cygwin 3.6.9 results in successful runs:
> 
> $ gcc fifotest.c && ./a
> trying to open /tmp/thetestfifo.pipe for write
> trying to open /tmp/thetestfifo.pipe for read
> wr = 3
> rd = 4
> 
> 
> fifotest.c:
> 
> #include <fcntl.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <pthread.h>
> 
> const char *name = "/tmp/thetestfifo.pipe";
> 
> void *bg() {
>      printf("trying to open %s for read\n", name);
>      int rd = open(name, O_RDONLY);
>      printf("rd = %d\n", rd);
>      close(rd);
>      return 0;
> }
> 
> int main() {
>      mkfifo(name, 0666);
> 
>      pthread_t thr;
>      pthread_create(&thr, 0, bg, 0);
> 
>      printf("trying to open %s for write\n", name);
>      int wr = open(name, O_WRONLY);
>      printf("wr = %d\n", wr);
>      close(wr);
> 
>      void *thret;
>      pthread_join(thr, &thret);
> 
>      unlink(name);
> }

Thanks for the report. I could reproduce the issue and found the culprit.

commit 31bf91f867c5fadd7deb408cf06fe3af8e86bb74
Author: Mark Geisert <mark AT maxrnd DOT com>
Date:   Wed May 27 22:42:44 2026 -0700

    Cygwin: Ensure unused fd available for open()

    The existing logic for open() assumes an fd is always available in
    the fdtable for a created file.  This leads to a situation where, if
    there is no fd available due to the OPEN_MAX limit being hit, the
    file is created but cannot be referenced by a Cygwin fd.

    Move the fd reservation code to an earlier location within open().

    Reported-by: Christian Franke <Christian DOT Franke AT t-online DOT de>
    Addresses: https://cygwin.com/pipermail/cygwin/2026-May/259664.html
    Signed-off-by: Mark Geisert <mark AT maxrnd DOT com>
    Fixes: e859706578ba (* autoload.cc (NtCreateFile): Add.)

Mark, could you please have a look?

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
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 © 2026   by DJ Delorie     Updated Sep 20 2026