Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)
Date
Msg-id 29331.1575737694@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)  (Alexander Law <exclusion@gmail.com>)
Responses Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)  (Alexander Law <exclusion@gmail.com>)
List pgsql-bugs
Alexander Law <exclusion@gmail.com> writes:
> What is the reason for the previous shell still accessing logfile?
> Is the reason that we don't close it before unlinking the pid file?

> We can't close the logfile, as it is opened by CMD, not by the postgres
> process. (Postmaster is started by the command "CMD.EXE /C postgres ...
>> logfile".) So it is closed by the CMD shell after the postgres process
> exits and the postgres can't control this (as a child process).

Hmm ... so if we were talking about Unix, a reasonable solution would
be to avoid having a separate shell process, either by telling the shell
to "exec" the postmaster or by using fork/exec directly with no shell.
A 99% solution would be to use "&" so that the shell doesn't wait around
for the postmaster to die.

Are any of those ideas tenable on Windows?

            regards, tom lane



pgsql-bugs by date:

Previous
From: Alexander Law
Date:
Subject: Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)
Next
From: Alexander Law
Date:
Subject: Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)