Re: Service reboot leaves postmaster.pid

Lists: pgsql-cygwin
From: "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk>
To: "'pgsql-cygwin(at)postgresql(dot)org'" <pgsql-cygwin(at)postgresql(dot)org>
Subject: Service reboot leaves postmaster.pid
Date: 2001-06-14 12:16:00
Message-ID: E2870D8CE1CCD311BAF50008C71EDE8E01F745E7@MAIL_EXCHANGE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

Hello,
I'm running the postmaster as a service using cygrunsrv and this
seems to go fine apart from when I reboot it doesn't seem to remove the
postmaster.pid file, meaning it fails to start automatically after reboot.
Stoping and starting the service manually work fine. Anyone else had this
problem or any pointers where to look (don't know much about NT services).
Thanks,
- Stuart


From: Fred Yankowski <fred(at)ontosys(dot)com>
To: "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk>
Cc: "'pgsql-cygwin(at)postgresql(dot)org'" <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: Service reboot leaves postmaster.pid
Date: 2001-06-14 15:27:51
Message-ID: 20010614102751.A70357@enteract.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

I've seen this same problem when using a patched version of postmaster
that directly incorporates the service-management functions also
provided by cygrunsrv. I eventually got around the problem by
changing the postmaster and postgres code to ignore the SIGHUP signal.

SIGHUP normally causes postmaster to reread its configuration file.
Unfortunately, cygwin code linked into postmaster catches a
window-shutdown event during NT shutdown and sends a SIGHUP signal to
its own process, causing postmaster to start up its process of
rereading the config file. Something about this coincidence causes
postmaster to end up in the state where postmaster.pid is still
around after restart. I suspect that the reconfiguration process
hangs or is aborted during shutdown.

I'm planning to submit a patch to cygrunsrv that will give it an
optional feature to notice the event of NT shutdown and send a signal
to the managed process, much as is done for a manual stop with the
'--termsig' option. This will allow us to do the equivalent of
'pg_ctl -m fast stop' or 'pg_ctl -m immediate stop' at that time. But
my experiences with a prototype suggest that it's still necessary to
ignore SIGHUP in postmaster and postgres in that case because SIGHUP
can otherwise still interfere with shutdown.

On Thu, Jun 14, 2001 at 01:16:00PM +0100, Henshall, Stuart - WCP wrote:
> I'm running the postmaster as a service using cygrunsrv and this
> seems to go fine apart from when I reboot it doesn't seem to remove the
> postmaster.pid file, meaning it fails to start automatically after reboot.

--
Fred Yankowski fred(at)OntoSys(dot)com tel: +1.630.879.1312
Principal Consultant www.OntoSys.com fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA


From: Rolf Rolfs <rolf(at)familie-rolfs(dot)de>
To: "'pgsql-cygwin(at)postgresql(dot)org'" <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: Service reboot leaves postmaster.pid
Date: 2001-06-15 16:09:22
Message-ID: 3B2A3332.4578513A@familie-rolfs.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

Hello,

> I'm running the postmaster as a service using cygrunsrv and this
> seems to go fine apart from when I reboot it doesn't seem to remove the
> postmaster.pid file, meaning it fails to start automatically after reboot.
> Stoping and starting the service manually work fine. Anyone else had this
> problem or any pointers where to look (don't know much about NT services).

I have the same problem using Windows 2000, but I have the impression
that no signal will be sent to the postmaster on reboot or shutdown.

When I am stopping the service manually with 'net stop ...', a shutdown
message will be written.

Does Windows 2000 stops all services explicitely or will the processes
be stopped only?

--
===============================================================
Rolf Rolfs
Hölderlinweg 8/2 mailto:rolf(at)familie-rolfs(dot)de
71729 Erdmannhausen Tel.: +49 7144 331415
===============================================================