Re: Building Postgresql under Windows question - Mailing list pgsql-hackers

From Dann Corbit
Subject Re: Building Postgresql under Windows question
Date
Msg-id D425483C2C5C9F49B5B7A41F8944154702962196@postal.corporate.connx.com
Whole thread Raw
In response to Re: Building Postgresql under Windows question  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
> -----Original Message-----
> From: Andrew Dunstan [mailto:andrew@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.



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Building Postgresql under Windows question
Next
From: "Dann Corbit"
Date:
Subject: Re: Building Postgresql under Windows question