program will hang when dup and close fd opend by posix_openpt

Takashi Yano
Thu Jan 14 15:05:33 GMT 2021

On Thu, 14 Jan 2021 18:34:40 +0900
Takashi Yano via Cygwin-developers <> wrote:
> On Thu, 14 Jan 2021 13:48:25 +0800
> Peiyuan Song via Cygwin-developers <> wrote:
> > dup will clone all info from `fhandler_pty_master` except pty master
> > control thread and pty master forwarding thread, when close that fd
> > the `fhandler_pty_master` heap will be reclaimed, but  the thread run
> > on  `fhandler_pty_master` object will not stop. when close duped fd,
> > those threads will access the reclaimed space and cause this issue.
> Thanks for the report. Let me consider.

I came up with a solution. I will submit a patch for this issue
together with other patches after testing a while.

Takashi Yano <>

More information about the Cygwin-developers mailing list