Alexander Pinčuk created DAEMON-477:
---------------------------------------
Summary: Problem stopping Windows service in exe mode
Key: DAEMON-477
URL: https://issues.apache.org/jira/browse/DAEMON-477
Project: Commons Daemon
Issue Type: Bug
Components: prunsrv
Affects Versions: 1.5.0
Reporter: Alexander Pinčuk
I want to run a Java server app as a service. Application launch is controlled
by a batch script. Everything works as expected except for the service
stopping. The server app itself stops without any problems. But the Windows
service continues to wait and stops only after StopTimeout seconds.
This happens because prunsrv is waiting for conHost, to which it is attached,
to complete.
If you detach prunsrv from the console, everything starts works fine. From
prunsrv.c:
if (!apxDestroyJvm(timeout)) {
/* if we are not using JAVA apxDestroyJvm does nothing, check the
chid processes in case they hang */
apxLogWrite(APXLOG_MARK_DEBUG "apxDestroyJvm did nothing or
failed");
*/* detach service process from console */*
*FreeConsole();*
for (;;) {
if (!apxProcessTerminateChild( GetCurrentProcessId(), TRUE)) {
/* Just print the children processes once for debugging */
if (btimeoutelapsed)
break;
waited = waitedSinceStopCmd();
if (waited >= timeout)
break; /* Done */
Sleep(1000);
} else {
break;
}
}
}
If this is the right solution, I can prepare a GitHub PR.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)