[
https://issues.apache.org/jira/browse/DAEMON-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Pinčuk updated DAEMON-477:
------------------------------------
Description:
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");
*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; }
}
}
was:
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");
*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.
> 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
> Priority: Major
>
> 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");
> *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; }
> }
> }
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)