Dhruva Madhukar Bhatia created DAEMON-470: ---------------------------------------------
Summary: Service Stop Returns True, but the service is still running in the background Key: DAEMON-470 URL: https://issues.apache.org/jira/browse/DAEMON-470 Project: Commons Daemon Issue Type: Bug Components: Procrun Affects Versions: 1.3.4, 1.3.3 Environment: Windows Server 2019 Datacenter tomcat9 -> This issue is intermittent for version 9.0.102+ up to tomcat11 tomcat issue created: [69642 - net stop tomcat service returns turn but tomcat.exe is still running in the background|https://bz.apache.org/bugzilla/show_bug.cgi?id=69642] Reporter: Dhruva Madhukar Bhatia Attachments: common-daemonlog-relevant, serviceNotStoppedMemoryRiseCropped.PNG, tomcatLogsFile Tomcat uses common-daemon to install services. We installed a tomcat service using tomcat9.exe //US//TomcatService <-options> When we run net stop TomcatService we get a response The Apache Tomcat 9.0 TomcatService service was stopped successfully. However, if we check the currently running process we see that tomcat.exe is still running in the background. As can be seen from the attached tomcat logs as below: {code:java} org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called 08:51:12,069 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_APPLICATION] - Worker thread will flush remaining events before exiting. 08:51:12,070 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_APPLICATION] - Queue flush finished successfully within timeout. 08:51:12,070 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_COMMUNICATION] - Worker thread will flush remaining events before exiting. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_COMMUNICATION] - Queue flush finished successfully within timeout. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_DATABASE] - Worker thread will flush remaining events before exiting. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_DATABASE] - Queue flush finished successfully within timeout. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_CONFIGURATION] - Worker thread will flush remaining events before exiting. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_CONFIGURATION] - Queue flush finished successfully within timeout. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_SCRIPT_ERROR] - Worker thread will flush remaining events before exiting. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_SCRIPT_ERROR] - Queue flush finished successfully within timeout. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_SCRIPT] - Worker thread will flush remaining events before exiting. 08:51:12,071 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_SCRIPT] - Queue flush finished successfully within timeout. 08:51:12,072 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_SECURITY] - Worker thread will flush remaining events before exiting. 08:51:12,072 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_SECURITY] - Queue flush finished successfully within timeout. 08:51:12,072 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_ERROR] - Worker thread will flush remaining events before exiting. 08:51:12,072 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_ERROR] - Queue flush finished successfully within timeout. 08:51:12,072 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_AUTH] - Worker thread will flush remaining events before exiting. 08:51:12,072 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_AUTH] - Queue flush finished successfully within timeout. 08:51:12,073 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_AKKA] - Worker thread will flush remaining events before exiting. 08:51:12,073 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC_APPENDER_AKKA] - Queue flush finished successfully within timeout. >>>>>>>> TERMINATING JVM <<<<<<<<<< >>>>>>>> CALLING SYSTEM EXIT <<<<<<<<<<{code} the service stopped at 8:51:12, however after repeatedly checking for any running tomcat.exe process, we see that the service was actually stopped at 8:51:24 -> Thu Apr 3 08:51:23 CUT 2025 tomcat9.exe 1364 Services 0 1,417,944 K Thu Apr 3 08:51:24 CUT 2025 tomcat9.exe 1364 Services 0 901,252 K Thu Apr 3 08:51:24 CUT 2025 tomcat9.exe 1364 Services 0 355,456 K Below are the common-daemons logs when stopped successfully and when it fails: {code:java} When stopped successfully: [2025-04-03 08:49:58] [2025-04-03 08:50:01] [info] [ 5840] Apache Commons Daemon procrun (1.4.1.0 64-bit) started. [2025-04-03 08:50:01] [info] [ 5840] Running Service 'ThingWorx-Foundation'... [2025-04-03 08:50:01] [info] [ 3484] Starting service... [2025-04-03 08:50:02] [info] [ 3484] Service started in 1290 milliseconds. [2025-04-03 08:50:33] [info] [ 5840] Service SERVICE_CONTROL_STOP signalled. [2025-04-03 08:50:33] [info] [ 2740] Stopping service... [2025-04-03 08:50:35] [error] [ 5732] Failed to set service status. [2025-04-03 08:50:36] [error] [ 5732] The handle is invalid. [2025-04-03 08:50:36] [2025-04-03 08:50:38] [info] [ 7056] Apache Commons Daemon procrun (1.4.1.0 64-bit) started. When not stopped properly (process running) [2025-04-03 08:50:36] [2025-04-03 08:50:38] [info] [ 7056] Apache Commons Daemon procrun (1.4.1.0 64-bit) started. [2025-04-03 08:50:38] [info] [ 7056] Running Service 'ThingWorx-Foundation'... [2025-04-03 08:50:38] [info] [ 6912] Starting service... [2025-04-03 08:50:40] [info] [ 6912] Service started in 1436 milliseconds. [2025-04-03 08:51:09] [info] [ 7056] Service SERVICE_CONTROL_STOP signalled. [2025-04-03 08:51:09] [info] [ 376] Stopping service... [2025-04-03 08:51:12] [error] [ 3000] Failed to set service status. [2025-04-03 08:51:12] [info] [ 7056] Run service finished. [2025-04-03 08:51:12] [info] [ 7056] Apache Commons Daemon procrun finished. [2025-04-03 08:51:24] [info] [ 7300] Apache Commons Daemon procrun (1.4.1.0 64-bit) started. {code} We've already created this issue in the tomcat forum: [69642 - net stop tomcat service returns turn but tomcat.exe is still running in the background|https://bz.apache.org/bugzilla/show_bug.cgi?id=69642] Where we were guided to report the issue here. -- This message was sent by Atlassian Jira (v8.20.10#820010)