From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-02.nifty.com (conssluserg-02.nifty.com [210.131.2.81]) by sourceware.org (Postfix) with ESMTPS id 0ABF438708B8 for ; Thu, 14 Jan 2021 15:05:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0ABF438708B8 Received: from Express5800-S70 (x067108.dynamic.ppp.asahi-net.or.jp [122.249.67.108]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 10EF5TrD016225 for ; Fri, 15 Jan 2021 00:05:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 10EF5TrD016225 X-Nifty-SrcIP: [122.249.67.108] Date: Fri, 15 Jan 2021 00:05:33 +0900 From: Takashi Yano To: cygwin-developers@cygwin.com Subject: Re: program will hang when dup and close fd opend by posix_openpt Message-Id: <20210115000533.2f505196697741529c5740da@nifty.ne.jp> In-Reply-To: <20210114183440.ac0068e5ed64675efe1e3294@nifty.ne.jp> References: <20210114183440.ac0068e5ed64675efe1e3294@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2021 15:05:58 -0000 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