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 1ii27Q-00008r-P8 for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Dec 2019 20:09:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ii27P-0001Uh-BT for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Dec 2019 20:09:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ii27P-0001Ua-2s for pgsql-bugs@lists.postgresql.org; Thu, 19 Dec 2019 20:09:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ii27L-0007Vs-Ul for pgsql-bugs@lists.postgresql.org; Thu, 19 Dec 2019 20:09: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 xBJK9j3g012600; Thu, 19 Dec 2019 15:09:46 -0500 From: Tom Lane To: Alexander Lakhin cc: Kyotaro Horiguchi , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16161: pg_ctl stop fails sometimes (on Windows) In-reply-to: <5c7eaa87-8670-2008-3a15-337c133c12c2@gmail.com> References: <4741.1576684991@sss.pgh.pa.us> <26441.1576706955@sss.pgh.pa.us> <20191219.103948.2182167132387989763.horikyota.ntt@gmail.com> <32374.1576770248@sss.pgh.pa.us> <5c7eaa87-8670-2008-3a15-337c133c12c2@gmail.com> Comments: In-reply-to Alexander Lakhin message dated "Thu, 19 Dec 2019 23:00:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12598.1576786185.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 19 Dec 2019 15:09:45 -0500 Message-ID: <12599.1576786185@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alexander Lakhin writes: > Maybe we should change the condition to 'if (stat(fileName, &st) !=3D 0 = && > (err =3D GetLastError()) =3D=3D ERROR_ACCESS_DENIED)' to avoid unnecessa= ry > sleep with a loop iteration... Well, we have to loop back on file-not-found too ... > 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%2= BKHvWdHnbpDG2scTrxw%40mail.gmail.com Hmm, makes one wonder whether that's actually live code. regards, tom lane