|
From: Leif M. <le...@ta...> - 2005-02-27 01:47:15
|
Adam,
Firstly, I agree with most of what Dick said. If possible, try to
rework your
ServiceManager so that each instance is its own service. Version 3.2.0
has some
neat features that will make it easy to control and manage other
services. Problem
is that its release is still a ways off due to my schedule. The code is
in CVS though
if you don't mind development (UNSUPPORTED) versions.
The first problem with the Wrapper killing your JVM: I can't give
you a definite
cause without seeing the debug output of one of your restarts. Most
likely however
it is a timing issue as you said, caused by your system being under
heavy load.
To fix this, I would suggest using the tick based timer by setting the
wrapper.use_system_time=FALSE property. It is the default in 3.2.0 and much
more reliable. See the docs for details on what it does and how it is
different
from the old system time based timer.
If that doesn't clear up this problem then I would like to see the
debug output
(wrapper.debug=true) from your log file around the restart.
The second issue with the logouts is being caused because of a bug
in the JVM.
Java has a problem where it views any signal, including logouts as a
sign that it should
be shutdown. The Wrapper has features which protect the JVM that it
launched
from ever seeing this signal. But in your case, you are launching JVMs
which are
the grandchildren of the Wrapper and thus not protected.
As a quick fix, try adding the '-Xrs' parameter to those child JVMs
when they
are launched. That should work. Do not add it to the JVM being
launched directly
by the Wrapper as it will break several of the Wrapper's features. See
the docs
for the java command in the \tooldocs\win32\java.html page of your SDK docs.
The problem however is that even if you get all of the above
working, you are
in an unstable situation. If your service manager JVM crashes or hangs
then the
Wrapper will kill and restart it. The Wrapper does not know about the
grandchild
processes and so they will be left running.
A few people this year have asked about this kind of thing so I have
been giving
some thought about how to make this easier to do. To do it right
though is going to
take some work so it would not be available for a couple more releases
at least.
For now, I would suggest either adding some code to see if the child
JVMs are
already running on startup or using making each one a service as was
suggested
by Dick, but that will only work on Windows.
Another option is to add the wrapper.java.pidfile=bin/java.pid
property so that
the PID of the ServiceManager JVM is written to a file on startup.
That file can
then be read and its value passed to the child JVMs on startup along
with the pid
file's location. The child processes would then monitor this file. If
it goes away
or the pid that it contains is ever changed then it means that the parent
ServiceManager jvm was shutdown or restarted, meaning that they should shut
themselves down immediately. At this the least, this would be a good
safety
feature.
If your child processes were checking the pid file say every 10
seconds. Then
you could add the following property as well. wrapper.restart.delay=60
This
should give your child processes enough time to shut themselves down before
a new ServiceManager process is started in the event of a restart.
Hope this helps,
Cheers,
Leif
Adam Eijdenberg wrote:
>Hi all,
>
>We are trialling using the Java Service Wrapper for our product and so far are very impressed. We do however have two major issues that appear to manifest themselves mostly under Windows 2003 Server.
>
>To explain our issues, I'll first give some background on what our application does. Our application consists of 5 java processes, plus one we call the ServiceManager. The ServiceManager upon startup starts each of the other 5 processes by calling Runtime.getRuntime().exec(). It then continually checks that they are alive, and if not restarts them. It also has a Runtime.getRuntime().addShutdownHook() to ensure that its child processes are shutdown when it is shutdown.
>
>We are using the Java Service Wrapper (3.1.1) to wrap our ServiceManager by simply specifying our classname in the conf file. Our problems are as follows:
>
>1. When certain users log off from the server (via Remote Desktop), although the logs specify that the logged off signal is ignored, the child processes (ran via Runtime.getRuntime().exec() are killed).
>
>e.g.
>INFO | wrapper | 2005/02/14 15:22:14 | User logged out. Ignored.
>INFO | jvm 1 | 2005/02/14 15:22:14 | 15:22:14,421 INFO [ServiceRunner] Starting service scheduler
>INFO | jvm 1 | 2005/02/14 15:22:15 | 15:22:14,968 INFO [ServiceRunner] Starting service authenticator
>INFO | jvm 1 | 2005/02/14 15:22:15 | 15:22:14,984 INFO [ServiceRunner] Starting service freetext
>INFO | jvm 1 | 2005/02/14 15:22:15 | 15:22:15,015 INFO [ServiceRunner] Starting service conversion
>
>The ServiceRunner INFO messages are from our ServiceManager which is still running, but detecting the other service have shutdown so is restarting them.
>
>This is a problem as we are a web app, and users logged into our system will be kicked out as their sessions are tied to these running apps.
>
>Is there any way of preventing "child" processes of the wrapped service from also being killed?
>
>
>2. Every now and then, presumably when the server is under load, the JVM is terminated. This presents two problems, firstly that it is happening, and secondly that it doesn't call our shutdown hook, so the child processes aren't killed, but then when it is restarted by the service wrapper, the child processes are all started for a second time, leading to catastropic consequences to our application!
>
>INFO | jvm 1 | 2005/02/16 09:44:07 | 09:44:07,659 INFO [ServiceRunner] Starting service conversion
>ERROR | wrapper | 2005/02/17 08:13:29 | JVM appears hung: Timed out waiting for signal from JVM.
>ERROR | wrapper | 2005/02/17 08:13:29 | JVM did not exit on request, terminated
>STATUS | wrapper | 2005/02/17 08:13:34 | Launching a JVM...
>INFO | jvm 2 | 2005/02/17 08:13:35 | Wrapper (Version 3.1.1) http://wrapper.tanukisoftware.org
>INFO | jvm 2 | 2005/02/17 08:13:35 |
>INFO | jvm 2 | 2005/02/17 08:13:35 | 08:13:35,375 INFO [RpcHandler] RPC: invoking start
>INFO | jvm 2 | 2005/02/17 08:13:35 | 08:13:35,375 INFO [ServiceHandler] Reading configuration file
>INFO | jvm 2 | 2005/02/17 08:13:35 | 08:13:35,406 INFO [ServiceRunner] Starting service resourcecentre
>INFO | jvm 2 | 2005/02/17 08:13:37 | 08:13:37,250 INFO [ServiceRunner] Starting service resourcecentre
>INFO | jvm 2 | 2005/02/17 08:13:39 | 08:13:39,000 INFO [ServiceRunner] Starting service resourcecentre
>INFO | jvm 2 | 2005/02/17 08:13:40 | 08:13:40,406 INFO [ServiceRunner] Starting service freetext
>INFO | jvm 2 | 2005/02/17 08:13:40 | 08:13:40,734 INFO [ServiceRunner] Starting service resourcecentre
>INFO | jvm 2 | 2005/02/17 08:13:42 | 08:13:42,578 INFO [ServiceRunner] Starting service resourcecentre
>
>Is there any way to prevent the JVM appearing as hung when it isn't really?
>
>
>
>
>Look forward to hearing back from anyone!
>
>Cheers, Adam
>
>Adam Eijdenberg
>DYTECH SOLUTIONS Pty. Ltd.
>-----------------------------------
>
>Level 2, 25 Argyle Street
>GPO Box 642
>Hobart TAS 7000
>Ph: +61 3 6235 2222
>Fax: +61 3 6235 2299
>ada...@dy...
>www.dytech.com.au
>-----------------------------------
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
>_______________________________________________
>Wrapper-user mailing list
>Wra...@li...
>https://lists.sourceforge.net/lists/listinfo/wrapper-user
>
>
>
|