Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Chris Travers <chris(at)metatrontech(dot)com>, Cristian Bittel <cbittel(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Date: 2010-09-09 17:48:42
Message-ID: 2521.1284054522@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> On Tue, Aug 24, 2010 at 15:58, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Given the existence of the deadman switch mechanism (which I hadn't
>> remembered when this thread started), I'm coming around to the idea that
>> we could just treat exit(128) as nonfatal on Windows. If for some
>> reason the child hadn't died instantly at startup, the deadman switch
>> would distinguish that from the case described here.

> Just to be clear, do you mean something as simple as this?

That seems like a rather klugy place and way to insert the fix. One
complaint about it is that the notice won't get logged nicely. It'd be
better if the main reaper() code was responsible for ignoring 128 so
that it could log the fact that it'd done so in the regular postmaster
log.

Another issue is that "nonfatal" doesn't mean "successful". In
particular, if this happened for the startup process, or probably some
other cases, taking the exit code as 0 would cause seriously wrong
things to happen.

On balance I think I'd suggest an #ifdef WIN32 in CleanupBackend that
made it accept 128 as a "normal exit" case. That would allow normal
processing to continue only when this happens to a regular backend,
which is probably sufficient for the purpose.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2010-09-09 17:57:35 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Magnus Hagander 2010-09-09 17:35:59 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-09-09 17:51:13 Re: returning multiple result sets from a stored procedure
Previous Message Magnus Hagander 2010-09-09 17:35:59 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session