Opening a fifo causes a deadlock on Cygwin 3.6.10
kikairoya via Cygwin <[email protected]> Wed, 15 Jul 2026 11:20:29 +0000
| Newsgroups | gmane.os.cygwin |
|---|---|
| Message-ID | <[email protected]> |
------sinikael-?=_1-17841144290690.8895908633777303
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
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);
}
Regards,
--
Tomohiro Kashiwada (@kikairoya)
------sinikael-?=_1-17841144290690.8895908633777303
Content-Type: text/plain
Content-Disposition: attachment; filename=fifotest.c
Content-Transfer-Encoding: quoted-printable
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
const char *name =3D "/tmp/thetestfifo.pipe";
void *bg() {
printf("trying to open %s for read\n", name);
int rd =3D open(name, O_RDONLY);
printf("rd =3D %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 =3D open(name, O_WRONLY);
printf("wr =3D %d\n", wr);
close(wr);
void *thret;
pthread_join(thr, &thret);
unlink(name);
}
------sinikael-?=_1-17841144290690.8895908633777303
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--
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
------sinikael-?=_1-17841144290690.8895908633777303--