JDK-4991286 : thread misses ThreadDeath of StopThread on Server VM
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,solaris_9,windows_nt
  • CPU: x86
  • Submitted: 2004-02-09
  • Updated: 2004-05-06
  • Resolved: 2004-04-08
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description

Name: pvR10198			Date: 02/09/2004


---------------------------------------------------
Test        : nsk/jvmti/StopThread/stopthrd007
VM          : ServerVM
Mode        : -Xcomp, -Xmixed
Platform    : x86
OS          : generic
JDK         : 1.5.0
---------------------------------------------------

The test exercises JVMTI function StopThread.
Debugee part of the test runs 3 threads:
  - running in a conditional loop
  - waiting on Object.wait()
  - sleeping on Thread.sleep()
then agent part of the test calls StopThread with an instance of
ThreadDeath for these threads and the debugee checks that
the threads are killed with ThreadDeath.

The test fails with serverVM on all x86 platforms in -Xcomp/-Xmixed modes.
The test passes with clientVM on all platforms in all modes.
The test passes with serverVM on all platforms in -Xint mode.
The test passes on Solsparc with both VMs in all modes.

To reproduce the test failure run doit.sh script in
GammaBase/Bugs/<this bug number> directory:

    sh doit.sh <JAVA_HOME> <java_options>

Running the test outputs:

$ sh doit.sh $JDK15/solsparc -server

java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b37)
Java HotSpot(TM) Server VM (build 1.5.0-beta2-b37, mixed mode)

#>  
#>  WARNING: switching log to verbose mode,
#>      because error is complained
#>  
Debugee started
Starting tested threads
Finishing tested threads
# ERROR: DebuggeeRunningThread: ThreadDeath lost
DebuggeeWaitingThread: got ThreadDeath
DebuggeeSleepingThread: got ThreadDeath
Debugee finished


#>  
#>  SUMMARY: Following errors occured
#>      during test execution:
#>  
# ERROR: DebuggeeRunningThread: ThreadDeath lost
Exit Code: 97
======================================================================


This issue also arises with the following test on windows-ia64 :-

nsk/jvmti/scenarios/capability/CM03/cm03t001

Comments
EVALUATION The description is correct and the test does fail with the server VM on both linux-i586 and windows-i586. However this is ThreadStop on a busy thread and isn't a worry for tiger (java.lang.Thread.stop is deprecated for many good reasons). In this case ThreadStop does send the async exception - the running thread traps to the compiled code safepoint handler which checks for the async exception and sets ThreadDeath as a pending exception. $ ./doit.sh $JAVA_HOME -server -XX:+TraceExceptions : Pending Async. exception installed of type: java.lang.ThreadDeath Pending Async. exception installed of type: java.lang.ThreadDeath Pending Async. exception installed of type: java.lang.ThreadDeath Async. exception installed at runtime exit of type: java.lang.ThreadDeath Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20 ) thrown [/BUILD_AREA/jdk1.5.0/hotspot/src/os/linux/vm/objectMonitor_linux.cpp, line 717] for thread 0x080f17d8 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'wait' '(J)V' in 'java/lang/Object'> at bci 0 for thread 0x080f17d8 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'run' '()V' in 'nsk/jvmti/StopThread/stopthrd007ThreadWaiting'> at bci 11 for thread 0x080f17d8 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'run' '()V' in 'nsk/jvmti/StopThread/stopthrd007ThreadWaiting'> at bci 37 for thread 0x080f17d8 Async. exception installed at runtime exit of type: java.lang.ThreadDeath Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20 ) thrown [/BUILD_AREA/jdk1.5.0/hotspot/src/share/vm/prims/jvm.cpp, line 2472] for thread 0x080c4060 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'sleep' '(J)V' in 'java/lang/Thread'> at bci 0 for thread 0x080c4060 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'run' '()V' in 'nsk/jvmti/StopThread/stopthrd007ThreadSleeping'> at bci 10 for thread 0x080c4060 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'run' '()V' in 'nsk/jvmti/StopThread/stopthrd007ThreadSleeping'> at bci 36 for thread 0x080c4060 Async. exception installed at runtime exit of type: java.lang.ThreadDeath Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'run' '()V' in 'nsk/jvmti/StopThread/stopthrd007ThreadRunning'> at bci 50 for thread 0x080c3bd8 Exception <a 'java/lang/ThreadDeath'> (0x45ce8b20) thrown in interpreter method <{method} 'run' '()V' in 'nsk/jvmti/StopThread/stopthrd007ThreadRunning'> at bci 76 for thread 0x080c3bd8 --------- CHECK STATUS ------------- #> #> WARNING: switching log to verbose mode, #> because error is complained #> Debugee started Starting tested threads Finishing tested threads # ERROR: DebuggeeRunningThread: ThreadDeath lost running thread, status=0, counter=14013444 DebuggeeWaitingThread: got ThreadDeath DebuggeeSleepingThread: got ThreadDeath Debugee finished #> #> SUMMARY: Following errors occured #> during test execution: #> # ERROR: DebuggeeRunningThread: ThreadDeath lost Exit Code: 97 ###@###.### 2004-02-11 ###@###.### 2004-04-07 The problem is caused by lazy deoptimization with pending exception. See evaluations and comments in the 5024600 and 5023643. I am closing this bug as duplicate of the new bug 5023643 which exposed the problem. The runtime group works on it.
11-06-2004