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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Chris Travers <chris(at)metatrontech(dot)com>, Cristian Bittel <cbittel(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Date: 2010-08-24 13:43:00
Message-ID: 201008241343.o7ODh0N21461@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas wrote:
> >> This isn't really a "fix" for the bug in the sense that the nicest
> >> thing of all would be to prevent the child from exiting abnormally in
> >> the first place. ?But it's far from clear that we can control that.
> >
> > This URL has some interesting details on our problem:
> >
> > ? ? ? ?http://stackoverflow.com/questions/139090/getexitcodeprocess-returns-128
> >
> > Error code 128 is identified as:
> >
> > ? ? ? ?error code 128 RROR_WAIT_NO_CHILDREN 128 0x80 There are no child
> > ? ? ? ?processes to wait for
> >
> > and the suggested cause is:
> >
> > ? ? ? ?Have a look at Desktop Heap memory.
> >
> > ? ? ? ?Essentially the desktop heap issue comes down to exhausted resources (eg
> > ? ? ? ?starting too many processes). When your app runs out of these resources,
> > ? ? ? ?one of the symptoms is that you won't be able to start a new process,
> > ? ? ? ?and the call to CreateProcess will fail with code 128.
> >
> > My guess is that at the time of CreateProcess(), there is enough desktop
> > heap memory, but at some later time, perhaps caused by a logout, there
> > isn't and the process never gets started.
>
> Yeah, that seems very plausible, although exactly how to verify I don't know.

And here is confirmation from the Microsoft web site:

http://support.microsoft.com/kb/156484

Cmd.exe, Perl.exe, or other console-mode applications may fail to
initialize properly and terminate prematurely when launched by a service
using the CreateProcess() or CreateProcessAsUser() APIs. The calling
process has no way of knowing that the launched console-mode application
has terminated prematurely.

In some instances, calling GetExitCode() against the failed process
indicates the following exit code:
128L ERROR_WAIT_NO_CHILDREN - There are no child processes to wait for.
...
Internet Information Server (IIS) may exhibit this problem
intermittently when processing CGI or Perl scripts. In this case the
browser returns the following error when executing CGI scripts:

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-08-24 13:58:52 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Robert Haas 2010-08-24 13:38:43 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-24 13:58:52 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Robert Haas 2010-08-24 13:38:43 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session