Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4401654
Votes 0
Synopsis VM exits during user logoff on Windows 2000
Category hotspot:other
Reported Against 1.3
Release Fixed
State 11-Closed, duplicate of 4323062, bug
Priority: 1-Very High
Related Bugs 4323062
Submit Date 04-JAN-2001
Description
From  customer :

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.
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   

Submitted On 17-APR-2001
rfikki
JVMI2 - The Java/NT Services Utility NT4/2000 Version 2 - April 14, 2001
Available at http://www.kcmultimedia.com/jvmi/

JVMI2 provides everything needed for running pure Java applications as NT services. 
In addition to its original role as a simple alternative to java.exe for trapping 
logoff events with JDK 1.3.0, it provides a great deal of new functionality. 

1) Command line installation or removal of your Java applications as NT services 
2) Easy configuration of service and display names, working directory, redirection of
   System.out and System.err to a log file, service dependencies and arguments to
   the JVM and your application, using XML formatted text files. 
3) Automatically traps logoff events if using JDK 1.3.0 
4) Provides a simple mechanism for pure Java applications to receive stop events
   from NT by implementing the provided SCMEventManager Java code. 
5) Improved event-logging and error reporting to assist in debugging troublesome
   installations. 


Submitted On 06-JUL-2001
RRRRyan
Check out jdk1.3.1-beta it works! However 1.3.1-b24 
(release) does not... 



PLEASE NOTE: JDK6 is formerly known as Project Mustang