pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster
2+ messages / 1 participants
[nested] [flat]

* pgsql: In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster
@ 2019-12-10 18:17  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-12-10 18:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster log file.

On Windows, we use CMD.EXE to redirect the postmaster's stdout/stderr
into a log file.  CMD.EXE will open that file with non-sharing-friendly
parameters, and the file will remain open for a short time after the
postmaster has removed postmaster.pid.  This can result in an
ERROR_SHARING_VIOLATION failure if we attempt to start a new postmaster
immediately with the same log file (e.g. during "pg_ctl restart").
This seems to explain intermittent buildfarm failures we've been seeing
on Windows machines.

To fix, just open and close the log file using our own pgwin32_open(),
which will wait if necessary to avoid the failure.  (Perhaps someday
we should stop using CMD.EXE, but that would be a far more complex
patch, and it doesn't seem worth the trouble ... yet.)

Back-patch to v12.  This only solves the problem when frontend fopen()
is redirected to pgwin32_fopen(), which has only been true since commit
0ba06e0bf.  Hence, no point in back-patching further, unless we care
to back-patch that change too.

Diagnosis and patch by Alexander Lakhin (bug #16154).

Discussion: https://postgr.es/m/16154-1ccf0b537b24d5e0@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/be9d4b9280606a0b0984ba46c452a48961cf92d4

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster
@ 2019-12-10 18:17  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-12-10 18:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster log file.

On Windows, we use CMD.EXE to redirect the postmaster's stdout/stderr
into a log file.  CMD.EXE will open that file with non-sharing-friendly
parameters, and the file will remain open for a short time after the
postmaster has removed postmaster.pid.  This can result in an
ERROR_SHARING_VIOLATION failure if we attempt to start a new postmaster
immediately with the same log file (e.g. during "pg_ctl restart").
This seems to explain intermittent buildfarm failures we've been seeing
on Windows machines.

To fix, just open and close the log file using our own pgwin32_open(),
which will wait if necessary to avoid the failure.  (Perhaps someday
we should stop using CMD.EXE, but that would be a far more complex
patch, and it doesn't seem worth the trouble ... yet.)

Back-patch to v12.  This only solves the problem when frontend fopen()
is redirected to pgwin32_fopen(), which has only been true since commit
0ba06e0bf.  Hence, no point in back-patching further, unless we care
to back-patch that change too.

Diagnosis and patch by Alexander Lakhin (bug #16154).

Discussion: https://postgr.es/m/16154-1ccf0b537b24d5e0@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0da33c762b85aeada111aa1371c33ac6737f8396

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-12-10 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 18:17 pgsql: In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster Tom Lane <tgl@sss.pgh.pa.us>
2019-12-10 18:17 pgsql: In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster Tom Lane <tgl@sss.pgh.pa.us>

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