[
https://issues.apache.org/jira/browse/DAEMON-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976579#action_12976579
]
Konstantin Kolinko commented on DAEMON-190:
-------------------------------------------
Firewall is not related: if I turn it off the issue is still reproducible.
It looks like I found the cause:
it is caused by the initial value of {{dwWorkerStatus}} in APXJAVAVM structure
and a race condition between {{serviceMain()}} thread and
{{__apxJavaWorkerThread()}} thread.
Note, that the initial value of the {{dwWorkerStatus}} field is zero, and then
{{__apxJavaWorkerThread()}} method sets it to 1 when JVM initialization is
successful:
{quote}
lpJava->dwWorkerStatus = 1;
{quote}
At the same time, {{serviceMain()}} method in prunsrv.c continues to run,
prints "Waiting for worker to finish..." message and calls
{quote}
rv = apxHandleWait(gWorker, INFINITE, FALSE);
{quote}
The apxHandleWait call results in calling {{apxJavaWait()}} in javajni.c, and
apxJavaWait() does this check:
{quote}
if (!lpJava->dwWorkerStatus && lpJava->hWorkerThread)
return WAIT_OBJECT_0;
{quote}
If {{dwWorkerStatus}} has not been set to "1" yet and has its initial value of
zero, the above check will succeed and the wait method will return immediately.
The {{serviceMain()}} prints "Worker finished." and starts shutting down. That
is the issue.
> Service startup fails at boot time on Windows
> ---------------------------------------------
>
> Key: DAEMON-190
> URL: https://issues.apache.org/jira/browse/DAEMON-190
> Project: Commons Daemon
> Issue Type: Bug
> Components: Procrun
> Affects Versions: 1.0.4
> Environment: Windows XP SP3 32-bit, Oracle JRE 6u22, Trying to run
> Tomcat 6.0.x (dev build).
> Reporter: Konstantin Kolinko
> Assignee: Mladen Turk
>
> Tomcat 6.0.x (a dev build) with Commons-Daemon 2.0.4 was installed and
> configured to autostart. The problem is that the service fails to start.
> After the system starts up the service is in stopped state.
> I do not use the PidFile setting (it is blank).
> If I start the service manually, it starts successfully.
> I configured prunsrv logging level to be Debug, and here is what is observed
> during boot time:
> [2010-12-20 15:14:25] [debug] ( prunsrv.c:1493) Commons Daemon procrun log
> initialized
> [2010-12-20 15:14:25] [info] ( :0 ) Commons Daemon procrun
> (1.0.4.0 32-bit) started
> [2010-12-20 15:14:25] [info] ( :0 ) Running 'Tomcat6' Service...
> [2010-12-20 15:14:25] [debug] ( prunsrv.c:1241) Inside ServiceMain...
> [2010-12-20 15:14:25] [info] ( :0 ) Starting service...
> [2010-12-20 15:14:25] [debug] ( javajni.c:191 ) loading jvm 'C:\Program
> Files\Java\jre6\bin\client\jvm.dll'
> [2010-12-20 15:14:27] [debug] ( javajni.c:643 ) Jvm Option[0]
> -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 6.0
> [2010-12-20 15:14:27] [debug] ( javajni.c:643 ) Jvm Option[1]
> -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 6.0
> [2010-12-20 15:14:27] [debug] ( javajni.c:643 ) Jvm Option[2]
> -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\endorsed
> [2010-12-20 15:14:28] [debug] ( javajni.c:643 ) Jvm Option[3]
> -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp
> [2010-12-20 15:14:28] [debug] ( javajni.c:643 ) Jvm Option[4]
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> [2010-12-20 15:14:28] [debug] ( javajni.c:643 ) Jvm Option[5]
> -Djava.util.logging.config.file=C:\Program Files\Apache Software
> Foundation\Tomcat 6.0\conf\logging.properties
> [2010-12-20 15:14:28] [debug] ( javajni.c:643 ) Jvm Option[6]
> -Djava.class.path=C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\bin\bootstrap.jar
> [2010-12-20 15:14:28] [debug] ( prunsrv.c:1054) Java started
> org/apache/catalina/startup/Bootstrap
> [2010-12-20 15:14:29] [info] ( :0 ) Service started in 3781 ms.
> [2010-12-20 15:14:30] [debug] ( prunsrv.c:1364) Waiting for worker to
> finish...
> [2010-12-20 15:14:30] [debug] ( prunsrv.c:1369) Worker finished.
> [2010-12-20 15:14:31] [debug] ( prunsrv.c:1392) Waiting for all threads to
> exit
> [2010-12-20 15:14:31] [debug] ( prunsrv.c:1396) JVM destroyed.
> [2010-12-20 15:14:45] [debug] ( javajni.c:827 ) argv[0] = start
> [2010-12-20 15:14:45] [debug] ( javajni.c:874 ) Java Worker thread started
> org/apache/catalina/startup/Bootstrap:main
> [2010-12-20 15:14:45] [info] ( :0 ) Run service finished.
> [2010-12-20 15:14:46] [info] ( :0 ) Commons Daemon procrun
> finished
> There is nothing in Tomcat logs, nor in stderr/stdout logs, besides "Commons
> Daemon procrun stderr initialized" or ..stdout... messages. The odd thing is
> that "Worker finished." message above.
> Here is another failed startup at boot time:
> [2010-12-20 15:02:18] [debug] ( prunsrv.c:1493) Commons Daemon procrun log
> initialized
> [2010-12-20 15:02:19] [info] ( :0 ) Commons Daemon procrun
> (1.0.4.0 32-bit) started
> [2010-12-20 15:02:19] [info] ( :0 ) Running 'Tomcat6' Service...
> [2010-12-20 15:02:19] [debug] ( prunsrv.c:1241) Inside ServiceMain...
> [2010-12-20 15:02:19] [info] ( :0 ) Starting service...
> [2010-12-20 15:02:20] [debug] ( javajni.c:191 ) loading jvm 'C:\Program
> Files\Java\jre6\bin\client\jvm.dll'
> [2010-12-20 15:02:21] [debug] ( javajni.c:643 ) Jvm Option[0]
> -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 6.0
> [2010-12-20 15:02:21] [debug] ( javajni.c:643 ) Jvm Option[1]
> -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 6.0
> [2010-12-20 15:02:21] [debug] ( javajni.c:643 ) Jvm Option[2]
> -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\endorsed
> [2010-12-20 15:02:22] [debug] ( javajni.c:643 ) Jvm Option[3]
> -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp
> [2010-12-20 15:02:22] [debug] ( javajni.c:643 ) Jvm Option[4]
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> [2010-12-20 15:02:22] [debug] ( javajni.c:643 ) Jvm Option[5]
> -Djava.util.logging.config.file=C:\Program Files\Apache Software
> Foundation\Tomcat 6.0\conf\logging.properties
> [2010-12-20 15:02:23] [debug] ( javajni.c:643 ) Jvm Option[6]
> -Djava.class.path=C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\bin\bootstrap.jar
> [2010-12-20 15:02:22] [debug] ( prunsrv.c:1054) Java started
> org/apache/catalina/startup/Bootstrap
> [2010-12-20 15:02:24] [info] ( :0 ) Service started in 3375 ms.
> [2010-12-20 15:02:24] [debug] ( prunsrv.c:1364) Waiting for worker to
> finish...
> [2010-12-20 15:02:24] [debug] ( prunsrv.c:1369) Worker finished.
> [2010-12-20 15:02:25] [debug] ( prunsrv.c:1392) Waiting for all threads to
> exit
> [2010-12-20 15:02:24] [debug] ( javajni.c:827 ) argv[0] = start
> [2010-12-20 15:02:26] [debug] ( javajni.c:889 ) Java Worker thread finished
> org/apache/catalina/startup/Bootstrap:main with status=3
> For reference, here is successful startup when I start the service manually
> from prunmgr's menu:
> [2010-12-20 15:44:25] [debug] ( prunsrv.c:1493) Commons Daemon procrun log
> initialized
> [2010-12-20 15:44:25] [info] ( :0 ) Commons Daemon procrun
> (1.0.4.0 32-bit) started
> [2010-12-20 15:44:25] [info] ( :0 ) Running 'Tomcat6' Service...
> [2010-12-20 15:44:25] [debug] ( prunsrv.c:1241) Inside ServiceMain...
> [2010-12-20 15:44:25] [info] ( :0 ) Starting service...
> [2010-12-20 15:44:25] [debug] ( javajni.c:191 ) loading jvm 'C:\Program
> Files\Java\jre6\bin\client\jvm.dll'
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[0]
> -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 6.0
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[1]
> -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 6.0
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[2]
> -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\endorsed
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[3]
> -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[4]
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[5]
> -Djava.util.logging.config.file=C:\Program Files\Apache Software
> Foundation\Tomcat 6.0\conf\logging.properties
> [2010-12-20 15:44:25] [debug] ( javajni.c:643 ) Jvm Option[6]
> -Djava.class.path=C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\bin\bootstrap.jar
> [2010-12-20 15:44:25] [debug] ( javajni.c:827 ) argv[0] = start
> [2010-12-20 15:44:25] [debug] ( javajni.c:874 ) Java Worker thread started
> org/apache/catalina/startup/Bootstrap:main
> [2010-12-20 15:44:26] [debug] ( prunsrv.c:1054) Java started
> org/apache/catalina/startup/Bootstrap
> [2010-12-20 15:44:26] [info] ( :0 ) Service started in 1062 ms.
> [2010-12-20 15:44:26] [debug] ( prunsrv.c:1364) Waiting for worker to
> finish...
> I originally observed this issue on a WinXP SP3 32-bit system. I am able to
> reproduce it on another system running the same OS, and on Windows 7 running
> 64-bit version of procrun.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.