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 1idFJI-0004UT-IV for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Dec 2019 15:14:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1idFJG-0000GE-1s for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Dec 2019 15:14:22 +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 1idFJF-0000Fr-Mz for pgsql-bugs@lists.postgresql.org; Fri, 06 Dec 2019 15:14:21 +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 1idFJD-0007DE-3v for pgsql-bugs@lists.postgresql.org; Fri, 06 Dec 2019 15:14:20 +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 xB6FEGXT006121; Fri, 6 Dec 2019 10:14:16 -0500 From: Tom Lane To: Alexander Lakhin cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows) In-reply-to: References: <16154-1ccf0b537b24d5e0@postgresql.org> Comments: In-reply-to Alexander Lakhin message dated "Fri, 06 Dec 2019 11:00:01 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6119.1575645256.1@sss.pgh.pa.us> Date: Fri, 06 Dec 2019 10:14:16 -0500 Message-ID: <6120.1575645256@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alexander Lakhin writes: > If this file is still opened by the previous server shell (it can happen > when the previous server instance has unlinked it's pid file, but it's > CMD shell is still running), the next CMD start fails with the > aforementioned error message. Interesting. I wonder whether this explains all of the remaining buildfarm failures of this sort that we've been seeing even after 0ba06e0bf. > To fix this issue I propose the attached patch > (fix_logfile_sharing_violation ). This seems like a pretty ugly hack ... please at least make it #ifdef WIN32, so that the rest of us don't have to deal with it. Also, if I read it correctly, it causes a pre-existing logfile to get truncated, which has never happened before. Mode "a" would be a better choice. regards, tom lane