JDK-6508261 : NPE occurs in ThreadMXBean.getThreadInfo
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,linux_redhat_3.0
  • CPU: x86
  • Submitted: 2006-12-28
  • Updated: 2011-03-23
  • Resolved: 2011-03-08
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 Availability Release.

To download the current JDK release, click here.
JDK 7
7 b12Fixed
Related Reports
Duplicate :  
Description
NPE occurs in ThreadMXBean.getThreadInfo, both in 5.0u10 and 6.0fcs.

CONFIGURATION : 
 CPU : Intel(R) Xeon(TM) CPU 2.40GHz * 2
 Mem : 2GB
 OS :Red Hat Enterprise Linux AS release 3 (Taroon Update 5)
    ( Linux kronos 2.4.21-32.ELsmp #1 SMP Fri Apr 15 21:17:59 EDT 2005 i686 i686 i386 GNU/Linux )

REPRODUCE :
 1. unfold the attached test1.tgz
 2. Go to test1 directory and invoke 
        java -Xmx3m -Djava.library.path=native_LINUX Main

You will see the following message.

-------
kronos[14]% java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
tbaba@kronos[15]% java -Xmx3m -Djava.library.path=native_LINUX Main
java.lang.NullPointerException
        at java.lang.String.<init>(String.java:176)
        at java.lang.String.valueOf(String.java:2841)
        at java.lang.Thread.getName(Thread.java:1061)
        at java.lang.management.ThreadInfo.initialize(ThreadInfo.java:231)
        at java.lang.management.ThreadInfo.<init>(ThreadInfo.java:112)
        at sun.management.ThreadImpl.getThreadInfo0(Native Method)
        at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:147)
        at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:107)
        at Main.main(Main.java:15)
kronos[16]%

Comments
SUGGESTED FIX ------- threadService.cpp ------- 713,715c713,714 < if (owner != NULL) { < _blocker_object_owner = owner->threadObj(); < } else if (_thread_status == java_lang_Thread::BLOCKED_ON_MONITOR_ENTER) { --- > if ((owner == NULL && _thread_status == java_lang_Thread::BLOCKED_ON_MONITOR_ENTER) || > (owner != NULL && owner->is_attaching())) { 721c720,722 < } --- > } else if (owner != NULL) { > _blocker_object_owner = owner->threadObj(); > }
16-02-2007

EVALUATION This ran into the same problem as 6404306. The JNI attached thread being processed in the constructor of ThreadInfo is being initialized and has a null name.
05-01-2007