JDK-4529877 : RMID running as nohup process is being killed after closing terminal
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2001-11-20
  • Updated: 2001-11-26
  • Resolved: 2001-11-26
Related Reports
Duplicate :  
Description

Name: nt126004			Date: 11/20/2001


java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

- su
- start terminal session on Unix
- start the rmid daemon by executing:

  nohup /opt/jdk1.4.0/bin/rmid -J-Djava.security.policy=/etc/inet/rmid.policy -log /var/log/rmid > /var/log/rmid.log 2>&1 &
- close terminal
- start another terminal and check if the rmid daemon is still running, which
  it isn't

This behaviour I've seen before when adding a shutdown hook to the JVM, in that
case the signal mask seems to be changed (bugid #4412451). This bug has not
been resolved since reporting in feb. by us.

I figured it out, when doing the test above you should execute the 
command as root user. The activation deamon seems to run fine with other 
users.

The best way to test (closing shells seems to take a few seconds 
sometimes) is to tail the log file you generate.

start terminal as root
nohup rmid -J-Djava.security.policy=mypolicy.policy -log /tmp/rmid >/tmp/rmid.log 2>&1 &
ps -ef | grep rmid (shows rmid)
tail -f /tmp/rmid.log
Ctrl C
ps -ef | grep rmid (rmid gone)

I can remember this problem with signal masks for root user happened to 
crash our banking application at our customers site when tailing log 
files, but that had to do with registering a shutdown handler in JDK 1.3.0

Some extra information with regard to this problem. Why I thought non 
root users also had problems with the activation deamon being killed was 
because we have a /etc/init.d/rmid script that can be used by all 
developers and is executed at boor time of our server.

the actual command was:

#!/bin/sh

# Start/stop RMI activation deamon

JAVA="/opt/jdk1.4.0"
LOGDIR="/var/log/rmid"

case "$1" in
'start')

     su - diva -c "nohup ${JAVA}/bin/rmid 
-J-Djava.security.policy=/etc/inet/rmid.policy -l
og ${LOGDIR} > /var/log/rmid.log 2>&1 &"
     ;;

This requires every person executing /etc/init.d/rmid to log in as the 
diva user (our general purpose user) by supplying the password. However 
when root executes this script it doesn't have to log in as diva user, 
handy during reboot :-)

When executing this script as root user, the deamon will be killed with 
tail -f or a kill of the shell.

Today I also noticed at work with a JDK 1.3.0 rmid and a JDK 1.4.0 
activatable (Jini) service (reggie e.g.) a tail -f on the rmid log 
resulted in a kill of the reggie service and a restart by the activation 
deamon, very weird. i noticed this because the pid changed of reggie, we 
sometimes encounterd some strange behaviour, but now we know why. I have 
to test this a few times more because I can't reproduce it now, but it 
seems there are some strange things going on (depending on the user 
executing a command) that consume a lot of time to track down :-(
(Review ID: 134731) 
======================================================================

Comments
WORK AROUND Name: nt126004 Date: 11/20/2001 use the rmid daemon of JDK 1.3.x and pass JDK 1.4 as a CommandEnvironment for the ActivationGroup. ======================================================================
11-06-2004

EVALUATION I was able to reproduce the reported behavior on 1.4.0-rc-b87 and confirm that it does not occur with 1.3.1 (as reported). In 1.4, rmid now installs a "shutdown hook" of its own (as part of the "fix" for 4299012); in 1.3.x and earlier, rmid never installed any shutdown hooks. Therefore, it seems that this bug is caused by 4412451 (the general problem reported against any use of shutdown hooks) in conjunction with rmid's new use of shutdown hooks in 1.4. Therefore, I am closing this bug as a duplicate of 4412451. ###@###.### 2001-11-26
26-11-2001