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

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:57:35
Message-ID: AANLkTimVY9r6UnEKXjrf6xRZbq63ScvLcdWp74W1FHmK@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Thu, Sep 9, 2010 at 19:48, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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.

Agreed - I just wanted to throw it in somewhere for testing. Should've
mentioned htat.

> 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.

Seems reasonable. I'll whack it around for that - see attached.

Dave has a reasonably reproducible test environment. Unforunately it's
on 8.3, so this patch will be completely unsafe there (it doesn't have
the deadman switch). But hopefully it can be used to see it fixes this
problem (while introducing others)h

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Attachment Content-Type Size
win32_128.patch application/octet-stream 753 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-09-09 18:23:42 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Tom Lane 2010-09-09 17:48:42 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 18:23:42 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Pavel Stehule 2010-09-09 17:55:52 Re: returning multiple result sets from a stored procedure