Re: Building Postgresql under Windows question

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Building Postgresql under Windows question
Date: 2009-04-28 19:46:22
Message-ID: D425483C2C5C9F49B5B7A41F8944154702962196@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Andrew Dunstan [mailto:andrew(at)dunslane(dot)net]
> Sent: Tuesday, April 28, 2009 12:42 PM
> To: Dann Corbit
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Building Postgresql under Windows question
>
>
>
> Dann Corbit wrote:
> > Pg_ctl.exe is exiting with a success code from line 1946 of PG_CTL.C
> >
> > This is not appropriate behavior for a service unless shutdown has
> been
> > requested.
> >
>
> pg_ctl calls *StartServiceCtrlDispatcher*(). It can only get to the
> line
> you mention when called as a service after that call returns. MSDN
> states:
>
> "If *StartServiceCtrlDispatcher* succeeds, it connects the calling
> thread to the service control manager and does not return until all
> running services in the process have entered the SERVICE_STOPPED
> state."
>
> So it appears that something is causing your service to enter that
> state.

It is interesting that it happens even if I run no queries at all.

This is the only reference to the service control dispatcher I can find
in pg_ctl.c:

static void
pgwin32_doRunAsService(void)
{
SERVICE_TABLE_ENTRY st[] = {{register_servicename,
pgwin32_ServiceMain},
{NULL, NULL}};

if (StartServiceCtrlDispatcher(st) == 0)
{
write_stderr(_("%s: could not start service \"%s\":
error code %d\n"), progname, register_servicename, (int)
GetLastError());
exit(1);
}
}

BTW, the exit(1) calls should be exit(EXIT_FAILURE) though there will be
no difficulty on any POSIX system.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dann Corbit 2009-04-28 19:48:39 Re: Building Postgresql under Windows question
Previous Message Andrew Dunstan 2009-04-28 19:41:59 Re: Building Postgresql under Windows question