Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Date
Msg-id AANLkTimVY9r6UnEKXjrf6xRZbq63ScvLcdWp74W1FHmK@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Sep 9, 2010 at 19:48, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Magnus Hagander <magnus@hagander.net> writes:
>> On Tue, Aug 24, 2010 at 15:58, Tom Lane <tgl@sss.pgh.pa.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

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: returning multiple result sets from a stored procedure
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session