Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ii9oX-0003d2-Fo for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Dec 2019 04:22:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ii9oW-0005I3-98 for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Dec 2019 04:22:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ii9oV-0005Hw-Tw for pgsql-bugs@lists.postgresql.org; Fri, 20 Dec 2019 04:22:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ii9oT-0001hH-Hp for pgsql-bugs@lists.postgresql.org; Fri, 20 Dec 2019 04:22:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBK4Mqi9011705; Thu, 19 Dec 2019 23:22:52 -0500 From: Tom Lane To: Kyotaro Horiguchi cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16161: pg_ctl stop fails sometimes (on Windows) In-reply-to: <20191220.121632.1323043157186991390.horikyota.ntt@gmail.com> References: <32374.1576770248@sss.pgh.pa.us> <5c7eaa87-8670-2008-3a15-337c133c12c2@gmail.com> <12599.1576786185@sss.pgh.pa.us> <20191220.121632.1323043157186991390.horikyota.ntt@gmail.com> Comments: In-reply-to Kyotaro Horiguchi message dated "Fri, 20 Dec 2019 12:16:32 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11703.1576815772.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 19 Dec 2019 23:22:52 -0500 Message-ID: <11704.1576815772@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Kyotaro Horiguchi writes: > At Thu, 19 Dec 2019 15:09:45 -0500, Tom Lane wrote i= n = >> Alexander Lakhin writes: >>> It seems that the check for ERROR_DELETE_PENDING was added to >>> pgwin32_safestat() blindly, the issue wasn't reproduced at that time: >>> https://www.postgresql.org/message-id/CAB7nPqRJV6trFta-Qzgi6j2feuYR2ZC= %2BKHvWdHnbpDG2scTrxw%40mail.gmail.com >> Hmm, makes one wonder whether that's actually live code. > Even if it is actually dead code, it seems reasonable as it stands > since it is intending to read status of an existing file and the > caller is assumed not to be knowing of ERROR_ACCESS_DENIED. What I was wondering about was how come, if stat() can see the specific error code ERROR_DELETE_PENDING, we don't get to see that from CreateFile. The whole reason we have a problem here is that CreateFile won't return that code :-( ... so it seems possible that the code in pgwin32_safestat is just wrong because the case never happens. regards, tom lane