pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Law <exclusion@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)
Date: Sat, 07 Dec 2019 11:54:54 -0500
Message-ID: <29331.1575737694@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJ0YPFFa6nLbHBYbiu5HgKZ5XYnOLsW4RaJgdjp8LA6x4p4kxA@mail.gmail.com>
References: <16154-1ccf0b537b24d5e0@postgresql.org>
	<e5179494-715e-f8a3-266b-0cf52adac8f4@gmail.com>
	<CAA4eK1JwEciJePdqhYRezoWcr=JQvqyiEWxqgYMXSuZ40RQW3Q@mail.gmail.com>
	<CAJ0YPFFa6nLbHBYbiu5HgKZ5XYnOLsW4RaJgdjp8LA6x4p4kxA@mail.gmail.com>

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





view thread (12+ messages)  latest in thread

Message-ID: <29331.1575737694@sss.pgh.pa.us>
Permalink:  ../29331.1575737694@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29331.1575737694@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, amit.kapila16@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16154: pg_ctl restart with a logfile fails sometimes (on Windows)
  In-Reply-To: <29331.1575737694@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox