Re: Intermittent pg_ctl failures on Windows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: r(dot)zharkov(at)postgrespro(dot)ru
Cc: Badrul Chowdhury <bachow(at)microsoft(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Intermittent pg_ctl failures on Windows
Date: 2019-07-17 13:51:48
Message-ID: 26631.1563371508@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

r(dot)zharkov(at)postgrespro(dot)ru writes:
> pg_ctl now opens the postmaster.pid file using pgwin32_open() function
> to correctly handle share locks.

HEAD already does that, no? See f02259fe9.

> On Windows systems we cannot handle ERROR_DELETE_PENDING because
> GetLastError() returns ERROR_ACCESS_DENIED instead.
> So we rename the lock files before delete them.

This seems improbably broken/stupid. Also, I've not seen any buildfarm
failures that would match this; it's always pg_ctl complaining not the
postmaster.

> To avoid the second error we added the wait for cmd.exe finish in the
> do_stop() and do_restart() functions.

Hmmm ... there seems the germ of a good idea here, but can't we do
it with less (and less ugly) code?

Alternatively, perhaps we could fix things so that the parent cmd.exe
shell isn't involved in logfile access? That'd require teaching the
postmaster to open/redirect its stdout/stderr, which is kind of
annoying, but it might beat hacking things as you have done here.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ibrar Ahmed 2019-07-17 14:08:07 Re: block-level incremental backup
Previous Message Jeevan Chalke 2019-07-17 13:43:36 Re: block-level incremental backup