[
https://issues.apache.org/jira/browse/DAEMON-477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18056428#comment-18056428
]
Gary D. Gregory commented on DAEMON-477:
----------------------------------------
Can we check there is a console before freeing it? That would make it obvious
that we don't expect a console.
> 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)