Menu

#143 Wraper timeout does not wait long enough

v3.2.3
open-accepted
Service (34)
5
2014-08-16
2006-10-22
Stocker
No

My application sometimes completes shutdown in less tan
15 sec and other times needfs longer usually all is
complete in less than 30 sec.
However, if files are not closed then a manual 'repair'
is needed before the application can start again. We
are using the wrapper to avoid 'messy shutdown'!

I have attached a part of log and my conf.
The properties in question are:
#Wait up to 5 min for application to complete and jvm
to exit
wrapper.shutdown.timeout=300
wrapper.jvm_exit.timeout=300

The wrapper does not seem to wait long enough! in fact
the delay is LESS tha 15 sec - the default?

What is strange is that if the application is run in
console mode(with wrapper) and ctrl-c - then the
shutdown is proper and complete.

If the application is installed as a service - with the
wrapper - it installes correctly and can be started and
stopped mannually and works correctly every time - the
shutdownof the application seems to take about 12 sec.

If the application with wrapper is installed as a
service and allowed to start automatically - all works
fine!

The problem occurs when Windows XP is shutdown -
properly the machine shutdown is detected by the
wrapper and application shutdown is initiated properly
-0 but the wrapper does not wait long enough and in
fact the last message that the wrapper is finished does
not ever show up in the wrapper log.

Please see attached log & conf (as log-conf.txt)

Discussion

  • Stocker

    Stocker - 2006-10-22

    log - showing ok and failed shutdown + conf

     
  • Leif Mortenson

    Leif Mortenson - 2006-10-23

    Logged In: YES
    user_id=228081

    The Windows Service Manager has a problem where it is
    ignoring the hints I am giving it about the shutdown time
    and will timeout. You can see this if you attempt to stop
    the service using "net stop xxx". It will sometimes timeout
    and give an unable to stop error. The wrapper will continue
    to shutdown cleanly in the background however.

    The problem is that on system shutdown, when the net stop
    function times out, the system kills the process and
    continues to shutdown...

    A long time ago, I attempted to work around this by
    implementing a way to stop the service using the wrapper
    binary. This doesn't help with the system shutdown case
    however.

    I was just given a hint as to how to fix this last week. I
    was trying to avoid feature creap and get the fix to other
    critical bugs out the door so it is not in there yet. Let
    me throw together a quick dev build and I'll make it
    available for you to test.

    Cheers,
    Leif

     
  • Leif Mortenson

    Leif Mortenson - 2006-10-23
    • milestone: --> v3.2.3
    • assigned_to: nobody --> mortenson
    • status: open --> open-accepted
     
  • Leif Mortenson

    Leif Mortenson - 2006-10-23

    Logged In: YES
    user_id=228081

    I think I got this fixed. I have uploaded a dev build at
    the following URL. Could you please test it out and let me
    know the results.
    http://wrapper.tanukisoftware.org/tmp/3.2.4-a/wrapper-windows-x86-32-3.2.4-a.zip

    Cheers,
    Leif

     
  • Stocker

    Stocker - 2006-10-23

    Logged In: YES
    user_id=1623448

    Thanks for the effort!

    The good news is you didn't break anything!

    The bad news is the bug is ot resolved.

    Test:
    Downloaded 2.3.4-a as suggested.
    Copied wrapper.exe, wrapper.dll,wrapper.jar and
    wrappertest.jar to my test directory
    Did not change conf or any of my application

    Ran three tests:
    1) wrapper in console mode - all worked correctly
    2) wrapper as service - manually stopped - all work
    ed correctly
    3) wrapper as service - started manually and did windows
    shutdown - failed as before

    See wrapper 3.2.4-a test logs.txt attached

     
  • Stocker

    Stocker - 2006-10-23

    three test logs

     
  • Stocker

    Stocker - 2006-10-26

    Logged In: YES
    user_id=1623448

    I checked and my machine was set for 20 sec (the default). I
    changed it to:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
    WaitToKillServiceTimeout RG_SZ 200000

    Tried shutting down twice - this had no effect - the Wrapper
    seems to have been clobbered after about 4 sec! - the last
    part of the log is missing.

    I have changed my program to verify its files at start up -
    so things are correct and automatic as a service - but since
    the shutdown is NOT clean it is risky - it is ok for
    development or private use but I think if a user wants to
    use my program as a database - it should run on Linux -
    Windows is just too unpredictable! or the Service must be
    ended before shutdown!

    I will be testing the Wrapper on several other machines in
    the next while - to determine if it is my development
    machine or XP itself which is having this problem. Thanks
    for all your help

     
  • Stocker

    Stocker - 2006-10-31

    Logged In: YES
    user_id=1623448

    I have tried several XP machines and they all behave the
    same way!
    My conclusion: Auto shutdown is not supported with a non
    trivial wait under XP.
    This does not mean that the Wrapper cannot be used under XP
    - it means that XP is not intended to be used as a
    PRODUCTION SERVER; thus one ought to end a service manually
    if it takes anything over trivial(2 or 3 sec) time to stop.
    So that I don't have a problem I have done the following
    with my application:
    1: at shutdown it check and closes its files - carefully
    2: at startup it assumes that there was an emergency
    shutdown and checks that files are intact and 'repairs the
    files' if need be
    3: instructions to users include a STRONG suggestion that
    they shutdown the application manually before the shutdown
    the machine - since this can be placed in a bat file it is a
    simple click to stop the service it is just one command "net
    stop myService"

    I expect that when the wrapper runs on Linux or Win NT
    Server it will close properly at machine shutdown.

    The Wrapper code works like a charm!!!!

    PS do I still need the "wrappertest.jar" that you gave me to
    test this fix?

     

Log in to post a comment.

MongoDB Logo MongoDB