Building Postgresql under Windows question
We are still having trouble with the service controller pg_ctl.exe
vanishing after some period of time.
Hence I am doing debug builds from the source tree according to the
instructions found at:
http://developer.postgresql.org/pgdocs/postgres/install-win32-full.html
Specifically, I am using this method:
It is also possible to build from inside the Visual Studio GUI. In this
case, you need to run:
perl mkvcbuild.pl
There are a few projects that will not build (only 7 out of 99).
I have not installed ossp-uuid yet, so one of the failures is expected.
On the CONTRIB projects I am not concerned at all.
However, on the internationalization failures, I want to know what the
failures mean.
Here is the output of the debug build process from the Visual Studio IDE
(includes all failures):
1>------ Build started: Project: utf8_and_euc_kr, Configuration: Debug
Win32 ------
1>Generate DEF file
1>Not re-generating UTF8_AND_EUC_KR.DEF, file already exists.
1>Linking...
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
euc_jp_to_utf8
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
pg_finfo_euc_jp_to_utf8
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
pg_finfo_utf8_to_euc_jp
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
utf8_to_euc_jp
1>Debug\utf8_and_euc_kr\utf8_and_euc_kr.lib : fatal error LNK1120: 4
unresolved externals
2>------ Build started: Project: utf8_and_euc_cn, Configuration: Debug
Win32 ------
3>------ Build started: Project: euc_kr_and_mic, Configuration: Debug
Win32 ------
1>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\utf8_and_euc_kr\B
uildLog.htm"
1>utf8_and_euc_kr - 5 error(s), 0 warning(s)
2>Generate DEF file
3>Generate DEF file
3>Not re-generating EUC_KR_AND_MIC.DEF, file already exists.
2>Not re-generating UTF8_AND_EUC_CN.DEF, file already exists.
3>Linking...
2>Linking...
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
euc_jp_to_mic
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
koi8r_to_utf8
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
pg_finfo_koi8r_to_utf8
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
euc_jp_to_sjis
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
pg_finfo_utf8_to_koi8r
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
mic_to_euc_jp
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
utf8_to_koi8r
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
mic_to_sjis
2>Debug\utf8_and_euc_cn\utf8_and_euc_cn.lib : fatal error LNK1120: 4
unresolved externals
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_euc_jp_to_mic
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_euc_jp_to_sjis
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_mic_to_euc_jp
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_mic_to_sjis
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_sjis_to_euc_jp
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_sjis_to_mic
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
sjis_to_euc_jp
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
sjis_to_mic
3>Debug\euc_kr_and_mic\euc_kr_and_mic.lib : fatal error LNK1120: 12
unresolved externals
2>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\utf8_and_euc_cn\B
uildLog.htm"
2>utf8_and_euc_cn - 5 error(s), 0 warning(s)
4>------ Build started: Project: utf8_and_shift_jis_2004, Configuration:
Debug Win32 ------
4>Generate DEF file
3>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\euc_kr_and_mic\Bu
ildLog.htm"
3>euc_kr_and_mic - 13 error(s), 0 warning(s)
4>Not re-generating UTF8_AND_SHIFT_JIS_2004.DEF, file already exists.
5>------ Build started: Project: uuid-ossp, Configuration: Debug Win32
------
5>Compiling...
4>Linking...
5>uuid-ossp.c
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol pg_finfo_uhc_to_utf8
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol pg_finfo_utf8_to_uhc
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol uhc_to_utf8
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol utf8_to_uhc
4>Debug\utf8_and_shift_jis_2004\utf8_and_shift_jis_2004.lib : fatal
error LNK1120: 4 unresolved externals
5>.\contrib\uuid-ossp\uuid-ossp.c(27) : fatal error C1083: Cannot open
include file: 'uuid.h': No such file or directory
5>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\uuid-ossp\BuildLo
g.htm"
5>uuid-ossp - 1 error(s), 0 warning(s)
4>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\utf8_and_shift_ji
s_2004\BuildLog.htm"
4>utf8_and_shift_jis_2004 - 5 error(s), 0 warning(s)
6>------ Build started: Project: hstore, Configuration: Debug Win32
------
6>Generate DEF file
6>Not re-generating HSTORE.DEF, file already exists.
7>------ Build started: Project: cube, Configuration: Debug Win32 ------
7>Generate DEF file
6>Linking...
6>hstore.def : error LNK2001: unresolved external symbol lo_manage
6>hstore.def : error LNK2001: unresolved external symbol
pg_finfo_lo_manage
6>Debug\hstore\hstore.lib : fatal error LNK1120: 2 unresolved externals
6>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\hstore\BuildLog.h
tm"
6>hstore - 3 error(s), 0 warning(s)
7>Not re-generating CUBE.DEF, file already exists.
7>Linking...
7>cube.def : error LNK2001: unresolved external symbol chkpass_eq
7>cube.def : error LNK2001: unresolved external symbol chkpass_in
7>cube.def : error LNK2001: unresolved external symbol chkpass_ne
7>cube.def : error LNK2001: unresolved external symbol chkpass_out
7>cube.def : error LNK2001: unresolved external symbol chkpass_rout
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_eq
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_in
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_ne
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_out
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_rout
7>Debug\cube\cube.lib : fatal error LNK1120: 10 unresolved externals
7>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\cube\BuildLog.htm
"
7>cube - 11 error(s), 0 warning(s)
========== Build: 0 succeeded, 7 failed, 92 up-to-date, 0 skipped
==========
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.
-----Original Message-----
From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
owner@postgresql.org] On Behalf Of Dann Corbit
Sent: Tuesday, April 28, 2009 11:47 AM
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] Building Postgresql under Windows questionWe are still having trouble with the service controller pg_ctl.exe
vanishing after some period of time.Hence I am doing debug builds from the source tree according to the
instructions found at:
http://developer.postgresql.org/pgdocs/postgres/install-win32-full.html
Specifically, I am using this method:
It is also possible to build from inside the Visual Studio GUI. In
this
case, you need to run:
perl mkvcbuild.plThere are a few projects that will not build (only 7 out of 99).
I have not installed ossp-uuid yet, so one of the failures is
expected.
On the CONTRIB projects I am not concerned at all.
However, on the internationalization failures, I want to know what the
failures mean.
Here is the output of the debug build process from the Visual Studio
IDE
(includes all failures):1>------ Build started: Project: utf8_and_euc_kr, Configuration: Debug
Win32 ------
1>Generate DEF file
1>Not re-generating UTF8_AND_EUC_KR.DEF, file already exists.
1>Linking...
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
euc_jp_to_utf8
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
pg_finfo_euc_jp_to_utf8
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
pg_finfo_utf8_to_euc_jp
1>utf8_and_euc_kr.def : error LNK2001: unresolved external symbol
utf8_to_euc_jp
1>Debug\utf8_and_euc_kr\utf8_and_euc_kr.lib : fatal error LNK1120: 4
unresolved externals
2>------ Build started: Project: utf8_and_euc_cn, Configuration: Debug
Win32 ------
3>------ Build started: Project: euc_kr_and_mic, Configuration: Debug
Win32 ------
1>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-
8.3.7\Debug\utf8_and_euc_kr\B
uildLog.htm"
1>utf8_and_euc_kr - 5 error(s), 0 warning(s)
2>Generate DEF file
3>Generate DEF file
3>Not re-generating EUC_KR_AND_MIC.DEF, file already exists.
2>Not re-generating UTF8_AND_EUC_CN.DEF, file already exists.
3>Linking...
2>Linking...
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
euc_jp_to_mic
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
koi8r_to_utf8
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
pg_finfo_koi8r_to_utf8
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
euc_jp_to_sjis
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
pg_finfo_utf8_to_koi8r
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
mic_to_euc_jp
2>utf8_and_euc_cn.def : error LNK2001: unresolved external symbol
utf8_to_koi8r
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
mic_to_sjis
2>Debug\utf8_and_euc_cn\utf8_and_euc_cn.lib : fatal error LNK1120: 4
unresolved externals
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_euc_jp_to_mic
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_euc_jp_to_sjis
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_mic_to_euc_jp
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_mic_to_sjis
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_sjis_to_euc_jp
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
pg_finfo_sjis_to_mic
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
sjis_to_euc_jp
3>euc_kr_and_mic.def : error LNK2001: unresolved external symbol
sjis_to_mic
3>Debug\euc_kr_and_mic\euc_kr_and_mic.lib : fatal error LNK1120: 12
unresolved externals
2>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-
8.3.7\Debug\utf8_and_euc_cn\B
uildLog.htm"
2>utf8_and_euc_cn - 5 error(s), 0 warning(s)
4>------ Build started: Project: utf8_and_shift_jis_2004,
Configuration:
Debug Win32 ------
4>Generate DEF file
3>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-
8.3.7\Debug\euc_kr_and_mic\Bu
ildLog.htm"
3>euc_kr_and_mic - 13 error(s), 0 warning(s)
4>Not re-generating UTF8_AND_SHIFT_JIS_2004.DEF, file already exists.
5>------ Build started: Project: uuid-ossp, Configuration: Debug Win32
------
5>Compiling...
4>Linking...
5>uuid-ossp.c
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol pg_finfo_uhc_to_utf8
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol pg_finfo_utf8_to_uhc
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol uhc_to_utf8
4>utf8_and_shift_jis_2004.def : error LNK2001: unresolved external
symbol utf8_to_uhc
4>Debug\utf8_and_shift_jis_2004\utf8_and_shift_jis_2004.lib : fatal
error LNK1120: 4 unresolved externals
5>.\contrib\uuid-ossp\uuid-ossp.c(27) : fatal error C1083: Cannot open
include file: 'uuid.h': No such file or directory
5>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-8.3.7\Debug\uuid-
ossp\BuildLo
g.htm"
5>uuid-ossp - 1 error(s), 0 warning(s)
4>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-
8.3.7\Debug\utf8_and_shift_ji
s_2004\BuildLog.htm"
4>utf8_and_shift_jis_2004 - 5 error(s), 0 warning(s)
6>------ Build started: Project: hstore, Configuration: Debug Win32
------
6>Generate DEF file
6>Not re-generating HSTORE.DEF, file already exists.
7>------ Build started: Project: cube, Configuration: Debug Win32
-----
-
7>Generate DEF file
6>Linking...
6>hstore.def : error LNK2001: unresolved external symbol lo_manage
6>hstore.def : error LNK2001: unresolved external symbol
pg_finfo_lo_manage
6>Debug\hstore\hstore.lib : fatal error LNK1120: 2 unresolved
externals
Show quoted text
6>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-
8.3.7\Debug\hstore\BuildLog.h
tm"
6>hstore - 3 error(s), 0 warning(s)
7>Not re-generating CUBE.DEF, file already exists.
7>Linking...
7>cube.def : error LNK2001: unresolved external symbol chkpass_eq
7>cube.def : error LNK2001: unresolved external symbol chkpass_in
7>cube.def : error LNK2001: unresolved external symbol chkpass_ne
7>cube.def : error LNK2001: unresolved external symbol chkpass_out
7>cube.def : error LNK2001: unresolved external symbol chkpass_rout
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_eq
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_in
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_ne
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_out
7>cube.def : error LNK2001: unresolved external symbol
pg_finfo_chkpass_rout
7>Debug\cube\cube.lib : fatal error LNK1120: 10 unresolved externals
7>Build log was saved at
"file://c:\dcorbit64\postgresql\postgresql-
8.3.7\Debug\cube\BuildLog.htm
"
7>cube - 11 error(s), 0 warning(s)
========== Build: 0 succeeded, 7 failed, 92 up-to-date, 0 skipped
==========--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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.
cheers
andrew
-----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 questionDann 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.
-----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 questionDann 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 appears that SERVICE_STOPPED comes from here:
static void WINAPI
pgwin32_ServiceMain(DWORD argc, LPTSTR * argv)
{
PROCESS_INFORMATION pi;
DWORD ret;
DWORD check_point_start;
/* Initialize variables */
status.dwWin32ExitCode = S_OK;
status.dwCheckPoint = 0;
status.dwWaitHint = 60000;
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP |
SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_PAUSE_CONTINUE;
status.dwServiceSpecificExitCode = 0;
status.dwCurrentState = SERVICE_START_PENDING;
memset(&pi, 0, sizeof(pi));
read_post_opts();
/* Register the control request handler */
if ((hStatus = RegisterServiceCtrlHandler(register_servicename,
pgwin32_ServiceHandler)) == (SERVICE_STATUS_HANDLE) 0)
return;
if ((shutdownEvent = CreateEvent(NULL, true, false, NULL)) ==
NULL)
return;
/* Start the postmaster */
pgwin32_SetServiceStatus(SERVICE_START_PENDING);
if (!CreateRestrictedProcess(pgwin32_CommandLine(false), &pi,
true))
{
pgwin32_SetServiceStatus(SERVICE_STOPPED);
return;
}
postmasterPID = pi.dwProcessId;
postmasterProcess = pi.hProcess;
CloseHandle(pi.hThread);
if (do_wait)
{
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Waiting for
server startup...\n"));
if (test_postmaster_connection(true) == false)
{
write_eventlog(EVENTLOG_INFORMATION_TYPE,
_("Timed out waiting for server startup\n"));
pgwin32_SetServiceStatus(SERVICE_STOPPED);
return;
}
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Server
started and accepting connections\n"));
}
/*
* Save the checkpoint value as it might have been incremented
in
* test_postmaster_connection
*/
check_point_start = status.dwCheckPoint;
pgwin32_SetServiceStatus(SERVICE_RUNNING);
/* Wait for quit... */
ret = WaitForMultipleObjects(2, shutdownHandles, FALSE,
INFINITE);
pgwin32_SetServiceStatus(SERVICE_STOP_PENDING);
switch (ret)
{
case WAIT_OBJECT_0: /* shutdown event */
kill(postmasterPID, SIGINT);
/*
* Increment the checkpoint and try again Abort
after 12
* checkpoints as the postmaster has probably
hung
*/
while (WaitForSingleObject(postmasterProcess,
5000) == WAIT_TIMEOUT && status.dwCheckPoint < 12)
status.dwCheckPoint++;
break;
case (WAIT_OBJECT_0 + 1): /* postmaster
went down */
break;
default:
/* shouldn't get here? */
break;
}
CloseHandle(shutdownEvent);
CloseHandle(postmasterProcess);
pgwin32_SetServiceStatus(SERVICE_STOPPED);
}
I will set a breakpoint on every place that the status is set to
SERVICE_STOPPED and report what I have found.
It's this one:
if (do_wait)
{
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Waiting for server
startup...\n"));
if (test_postmaster_connection(true) == false)
{
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Timed out
waiting for server startup\n"));
pgwin32_SetServiceStatus(SERVICE_STOPPED); //
<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE!
return;
}
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Server started and
accepting connections\n"));
}
The attached bitmap shows that the servers are running, though
pg_ctl.exe has exited.
I am also able to attach and query.
Show quoted text
-----Original Message-----
From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
owner@postgresql.org] On Behalf Of Dann Corbit
Sent: Tuesday, April 28, 2009 12:49 PM
To: Andrew Dunstan
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Building Postgresql under Windows question-----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 questionDann 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 appears that SERVICE_STOPPED comes from here:
static void WINAPI
pgwin32_ServiceMain(DWORD argc, LPTSTR * argv)
{
PROCESS_INFORMATION pi;
DWORD ret;
DWORD check_point_start;/* Initialize variables */
status.dwWin32ExitCode = S_OK;
status.dwCheckPoint = 0;
status.dwWaitHint = 60000;
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP |
SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_PAUSE_CONTINUE;
status.dwServiceSpecificExitCode = 0;
status.dwCurrentState = SERVICE_START_PENDING;memset(&pi, 0, sizeof(pi));
read_post_opts();
/* Register the control request handler */
if ((hStatus = RegisterServiceCtrlHandler(register_servicename,
pgwin32_ServiceHandler)) == (SERVICE_STATUS_HANDLE) 0)
return;if ((shutdownEvent = CreateEvent(NULL, true, false, NULL)) ==
NULL)
return;/* Start the postmaster */
pgwin32_SetServiceStatus(SERVICE_START_PENDING);
if (!CreateRestrictedProcess(pgwin32_CommandLine(false), &pi,
true))
{
pgwin32_SetServiceStatus(SERVICE_STOPPED);
return;
}
postmasterPID = pi.dwProcessId;
postmasterProcess = pi.hProcess;
CloseHandle(pi.hThread);if (do_wait)
{
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Waiting for
server startup...\n"));
if (test_postmaster_connection(true) == false)
{
write_eventlog(EVENTLOG_INFORMATION_TYPE,
_("Timed out waiting for server startup\n"));
pgwin32_SetServiceStatus(SERVICE_STOPPED);
return;
}
write_eventlog(EVENTLOG_INFORMATION_TYPE, _("Server
started and accepting connections\n"));
}/*
* Save the checkpoint value as it might have been incremented
in
* test_postmaster_connection
*/
check_point_start = status.dwCheckPoint;pgwin32_SetServiceStatus(SERVICE_RUNNING);
/* Wait for quit... */
ret = WaitForMultipleObjects(2, shutdownHandles, FALSE,
INFINITE);pgwin32_SetServiceStatus(SERVICE_STOP_PENDING);
switch (ret)
{
case WAIT_OBJECT_0: /* shutdown event */
kill(postmasterPID, SIGINT);/*
* Increment the checkpoint and try again Abort
after 12
* checkpoints as the postmaster has probably
hung
*/
while (WaitForSingleObject(postmasterProcess,
5000) == WAIT_TIMEOUT && status.dwCheckPoint < 12)
status.dwCheckPoint++;
break;case (WAIT_OBJECT_0 + 1): /* postmaster
went down */
break;default:
/* shouldn't get here? */
break;
}CloseHandle(shutdownEvent);
CloseHandle(postmasterProcess);pgwin32_SetServiceStatus(SERVICE_STOPPED);
}I will set a breakpoint on every place that the status is set to
SERVICE_STOPPED and report what I have found.--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Attachments:
pg-servers.jpgimage/jpeg; name=pg-servers.jpgDownload
���� JFIF ` ` �� C
$.' ",#(7),01444'9=82<.342�� C
2!!22222222222222222222222222222222222222222222222222�� �V"