[
https://issues.apache.org/jira/browse/DAEMON-466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17893641#comment-17893641
]
Pavlo commented on DAEMON-466:
------------------------------
//IS//DemoAgent --Startup=auto --ServiceUser=LocalSystem --Jvm
"${installdir}\jre\bin\server\jvm.dll" --Classpath
"${installdir}\demo\agent.jar" --JavaHome "${installdir}\jre" --StartPath
"${installdir}" --JvmOptions "-XX:+HeapDumpOnOutOfMemoryError" --StartMode=jvm
--StartClass=com.demo.Agent --StartMethod=main --StopMode=jvm
--StopClass=com.demo.Agent --StopMethod=stop
I was able to reproduce the bug with the minimal java program:
public class Agent implements Runnable {
public static void main(String[] args) {
try {
Thread.sleep(600000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public static void stop(String[] args) {
System.exit(0);
}
@Override
public void run() {
}
}
The service was started and stopped manually. When stopping it throws the error.
> Service crashes with 1067 when stopping
> ---------------------------------------
>
> Key: DAEMON-466
> URL: https://issues.apache.org/jira/browse/DAEMON-466
> Project: Commons Daemon
> Issue Type: Bug
> Components: prunsrv
> Affects Versions: 1.4.0
> Environment: Windows Server 2019 (version 1809)
> Java 17.0.11
> Reporter: Pavlo
> Priority: Major
>
> Starting with 1.4.0 the service crashes with "Error 1067: The process
> terminated unexpectedly" when stopping
>
> [2024-10-17 17:09:39] [info] ( prunsrv.c:1227) [ 1944] Stopping service...
> [2024-10-17 17:09:39] [debug] ( javajni.c:424 ) [ 1944]
> JNI_GetCreatedJavaVMs...
> [2024-10-17 17:09:39] [debug] ( javajni.c:1067) [ 8388] Java worker thread
> started for agent/Agent:stop
> [2024-10-17 17:09:39] [debug] ( javajni.c:1073) [ 8388] JNI calling static
> void method agent/Agent:stop
> [2024-10-17 17:09:40] [debug] ( prunsrv.c:1277) [ 1944] Waiting for Java JNI
> stop worker to finish for agent/Agent:stop...
> [2024-10-17 17:09:40] [debug] ( javajni.c:1167) [ 1944] apxJavaWait ->
> WaitForSingleObject (0x0000000000000660, -1 milliseconds) (-1=INFINITE)...
> [2024-10-17 17:09:41] [debug] ( javajni.c:571 ) [ 5476] Exit hook with exit
> code 0
>
>
> In previous versions (tested on 1.3.3 and 1.3.4) there are two additional
> logs after the exit hook which are *not* present in 1.4.0:
> [2024-10-17 17:09:15] [debug] ( javajni.c:571 ) [ 6576] Exit hook with exit
> code 0
> [2024-10-17 17:09:15] [debug] ( prunsrv.c:1194) [ 6576] Stop exit hook
> called...
> [2024-10-17 17:09:15] [debug] ( prunsrv.c:1127) [ 6576] reportServiceStatusE:
> dwCurrentState = 1 (SERVICE_STOPPED), dwWin32ExitCode = 0, dwWaitHint = 0
> milliseconds, dwServiceSpecificExitCode = 0.
>
> Also found this issue reported here
> https://issues.apache.org/jira/browse/DAEMON-435 but it is closed
--
This message was sent by Atlassian Jira
(v8.20.10#820010)