> -----Original Message-----
> From: Andrew Dunstan [mailto:and...@dunslane.net]
> Sent: Tuesday, April 28, 2009 12:42 PM
> To: Dann Corbit
> Cc: pgsql-hackers@postgresql.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.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to