JDK-4755829 : JVM 1.3.1-04 and Pre-release of JVM 1.3.1-05 ignoring nohup(1) command
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P2
  • Affected Version: 1.0.0,1.3.1_05,1.4.1_02,1.4.2
  • OS: generic,linux,solaris_8,solaris_9
  • CPU: generic,x86,sparc
  • Submit Date: 2002-10-01
  • Updated Date: 2012-10-08
  • Resolved Date: 2003-02-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
1.3.1_08 08Fixed
Related Reports
Duplicate :  
Relates :  
Description
The later release of JVM 1.3.1-04 to JVM 1.3.1-05 are ignoring the nohup(1)
command. Instead of ignoring the SIGHUP, it actually caught and process the
SIGHUP signal, resulting in the java application being exited with a return
code of 129.

nohup(1) command is working correctly on the following releases:

JVM 1.3.1-FCS   - OK
JVM 1.3.1-01    - OK
JVM 1.3.1-02    - OK
JVM 1.3.1-03    - OK

nohup(1) command is NOT working on the following releases:

JVM 1.3.1-04    - NOT OK (not ignored)
JVM 1.3.1-05pre - NOT OK (not ignored)

The above findings are reproducable.

Reproduction / How to / Test case:
----------------------------------

I have attached the tests scripts and the famous lt (loadtest)
java apps for the testing. just setup the directories below
on your test machine. Get all the JVM 1.3.1 releases.

bash-2.03# ls -l
total 70
-rwxr-xr-x   1 root     other         18 Sep 23 19:54 1.sh
-rwxr-xr-x   1 root     other         72 Sep 23 18:59 2.sh
-rwxr-xr-x   1 root     other        187 Sep 26 11:23 3-01.sh
-rwxr-xr-x   1 root     other        187 Sep 26 11:23 3-02.sh
-rwxr-xr-x   1 root     other        187 Sep 26 11:23 3-03.sh
-rwxr-xr-x   1 root     other        192 Sep 26 11:45 3-04-xrs.sh
-rwxr-xr-x   1 root     other        187 Sep 26 11:24 3-04.sh
-rwxr-xr-x   1 root     other        192 Sep 26 12:44 3-05-xrs.sh
-rwxr-xr-x   1 root     other        187 Sep 26 11:22 3-05.sh
-rwxr-xr-x   1 root     other        189 Sep 26 11:24 3-fcs.sh
drwxr-xr-x   7 root     other        512 Sep 26 10:03 jdk131_01
drwxr-xr-x   7 root     other        512 Sep 26 10:52 jdk131_02
drwxr-xr-x   4 root     other        512 Sep 26 11:09 jdk131_03
drwxr-xr-x   4 root     other        512 Sep 26 11:17 jdk131_04
drwx--x--x   8 root     other        512 Aug 30 22:12 jdk131_05
drwxr-xr-x   6 root     other        512 Sep 26 11:22 jdk131_fcs
-rw-r--r--   1 root     other       3419 Sep 23 18:54 lt.class
-rw-r--r--   1 root     other      11039 Sep 23 18:54 lt.java
-rw-r--r--   1 root     other       3514 Sep 23 18:54 ltThread.class

Run scripts starting with 3-0X where X is the release of JVM.
Scripts with -xrs are ran with Java option -Xrs (Workaround).

Below is a sample script, notice the nohup command at the beginning
of the java binary.
 
bash-2.03# more 3-02.sh
#!/bin/ksh
/temp1/jdk131_02/bin/java -version
nohup /temp1/jdk131_02/bin/java -ms256m -mx256m -DredirectOutputToFile=false lt -verbose:gc http://dolphin.singapore:8888 > /temp1/log.out &


In General, open 2 terminal windows. First one to run the script 
with truss and the second to send the signal to the java process
that was launched by the script. Repeat for all the 3-XX scripts.

1. Window1: 
   --------
   $ truss -af -sall ./3-04   
   [ add the -o <outfile> if you wish catch the truss output in file ]

2. Windows2:
   ---------
   $ ps -ef | grep java
     root  3672   ...... /java -ms256m -mx256m -Xrs -Dre
     
     Note the PPID, it should be 1.
     
   $ kill -1 3672   [To send a SIGHUP]
   
3. Window1:
   --------
   A functional JVM (1.3.1-03 and below) shows that SIGHUP is ignored.
   
   3672:   signotifywait()                                 = 1
   3672:   lwp_sigredirect(5, SIGHUP, 0xFF00FC4C)          = 0
-->3672:       Received signal #1, SIGHUP, in poll() [ignored]
   3672:         siginfo: SIGHUP pid=1763 uid=0
   3672:   poll(0xFEC07A50, 0, 10)                         = 0
   3672:   read(8, " < I M G   S R C = " / i".., 2048)     = 1999
   3672:   read(8, " " > < / T D >\n        ".., 2048)     = 1024
   3672:   poll(0xFEC07A50, 0, 10)                         = 0
   ...
   
   A broken JVM (1.3.1-04 and 1.3.1-05pre) shows that SIGHUP is being 
   caught and processed.
   
   3712:   signotifywait()                                 = 1
   3712:   lwp_sigredirect(5, SIGHUP, 0xFF00FC4C)          = 0
-->3712:       Received signal #1, SIGHUP, in poll() [caught]
   3712:         siginfo: SIGHUP pid=1763 uid=0
   3712:   poll(0xFEC07A50, 0, 10)                         Err#91 ERESTART
   3712:   lwp_mutex_wakeup(0xFF3855D8)                    = 0
   ...
   3712:   llseek(0, 0, SEEK_CUR)                          = 0
-->3712:   _exit(129)

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.3.1_08 1.4.0_04 1.4.1_03 mantis-beta FIXED IN: 1.3.1_08 1.4.0_04 1.4.1_03 mantis-beta tiger INTEGRATED IN: 1.3.1_08 1.4.0_04 1.4.1_03 mantis-b19 mantis-beta tiger tiger-b03
2004-09-17

WORK AROUND Use the -Xrs java option.
2004-09-17

SUGGESTED FIX Suggested webrev's are at http://SunWeb.Ireland.Sun.COM/~patc/singapore_webrev/ I'll update this field with the suggested fix once its approved.
2004-09-17

EVALUATION JPSE team will take over this bug ###@###.### 2002-10-01 the problem stems from a previous but fix for #4614121 java.io.File.deleteOnExit not working on Windows NT As part of this fix (for shutdown hooks), a new signal handler was set up for each of the shutdown hooks (of which SIGHUP was one). What we should do is to ignore the SIGHUP signal if it is masked when java starts up. ###@###.### 2002-10-09 ------------------------------------------------- Note the fix has introduced a new problem. With the fix, no shutdown hook will get executed if "nohup" is used. Please see 4850355 for details. ###@###.### 2003-04-18
2003-04-18