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 18:23:42
Message-ID: 3236.1284056622@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 Thu, Sep 9, 2010 at 19:48, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> On balance I think I'd suggest an #ifdef WIN32 in CleanupBackend that
>> made it accept 128 as a "normal exit" case.

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

Hm, still doesn't log, which I think it should, even for testing
purposes (how will you know the case occurred?). Maybe like this:

/*
* If a backend dies in an ugly way then we must signal all other backends
* to quickdie. If exit status is zero (normal) or one (FATAL exit), we
* assume everything is all right and proceed to remove the backend from
* the active backend list.
+ *
+ * On Windows, also treat ERROR_WAIT_NO_CHILDREN (128) as a nonfatal
+ * case, since that sometimes happens under load.
*/
+#ifdef WIN32
+ if (exitstatus == ERROR_WAIT_NO_CHILDREN)
+ {
+ LogChildExit(LOG, _("server process"), pid, exitstatus);
+ exitstatus = 0;
+ }
+#endif
+
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
{
HandleChildCrash(pid, exitstatus, _("server process"));
return;
}

> 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

Sounds like a plan.

We're not so worried about this case that we'd want to backport the
deadman switch into 8.3 or 8.2 to have a fix there, are we?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

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

Browse pgsql-hackers by date

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