From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows) |
Date: | 2019-12-06 15:40:12 |
Message-ID: | e8866e38-175b-b22a-1831-45cfda6494b7@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
06.12.2019 18:14, Tom Lane wrote:
> Alexander Lakhin <exclusion(at)gmail(dot)com> 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.
This change should go under the following code:
#else /* WIN32 */
/*
* As with the Unix case, it's easiest to use the shell (CMD.EXE) to
* handle redirection etc. Unfortunately CMD.EXE lacks any
equivalent of
* "exec", so we don't get to find out the postmaster's PID immediately.
*/
PROCESS_INFORMATION pi;
const char *comspec;
/* Find CMD.EXE location using COMSPEC, if it's set */
comspec = getenv("COMSPEC");
if (comspec == NULL)
comspec = "CMD";
So it should affect only Windows.
I've fixed the mode. Thanks for your review!
Best regards,
Alexander
Attachment | Content-Type | Size |
---|---|---|
fix_logfile_sharing_violation.patch | text/x-patch | 922 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2019-12-07 12:35:49 | Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows) |
Previous Message | Tom Lane | 2019-12-06 15:14:16 | Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows) |