JDK-4401654 : VM exits during user logoff on Windows 2000
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.3.0
  • Priority: P1
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.3
  • CPU: generic
  • Submitted: 2001-01-04
  • Updated: 2001-01-04
  • Resolved: 2001-01-04
Related Reports
Duplicate :  
Description
From Borland:

We have discovered something which is a serious issue for us when using JDK
1.3.

As you know, we have our own JVM launcher and do not use java.exe. Part of
the value-add this launcher provides is that, on NT and 2000, our server can
be installed as a Windows service. This worked fine under jdk 1.2.2, but so
well under 1.3. We're finding that when the user logs off after starting the
NT service, the JDK 1.3. VM does a forced exit and returns from the process
with an exit code of 143. We've found no way to stop this. Indeed, reading
the java.lang.Runtime.addShutdownHook() documentation I seems to be
intentional behavior
The Java virtual machine shuts down in response to two kinds of events:


    a.. The program exits normally, when the last non-daemon thread exits or
when the exit (equivalently, System.exit) method is invoked, or

    b.. The virtual machine is terminated in response to a user interrupt,
such as typing ^C, or a system-wide event, such as user logoff or system
shutdown.
This is obviously a problem for anyone, like us, who wants to write a long
lived (daemon) style process in java.

Can you please:

a) Am I correct in thinking that the JVM does not ignore the Windows logoff
event?
b) Does a process exit with code 143 mean "the user logged off"?
c) Is this behavior intentional?
d) Is there anyway to turn off this behavior and have the VM ignore user
logoff?
e) I'd also like the VM to ignore system shutdown and have my NT service
handler take care of it instead - is there a way to do this?
f) Is there anyway to work around this?

As always, this has come up at the 11th hour and we're under some time
pressure here! Any help appreciated.