JDK-6318850 : RedefineClasses() and NativeMethodBind event crash
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 5.0u4,6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_10
  • CPU: generic,sparc
  • Submitted: 2005-09-01
  • Updated: 2012-10-01
  • Resolved: 2005-11-30
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.
Other JDK 6
5.0u8Fixed 6 b62Fixed
Related Reports
Duplicate :  
Relates :  
Description
Ian Formanek report a problem with NativeMethodBind events that
were being posted during a RedefineClasses() call. Here is the
filtered hs_err file:

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  Internal Error (C:/BUILD_AREA/jdk1.5.0_04/hotspot\src\share\vm\runtime\thread
.hpp, 1349), pid=5796, tid=4048
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05-debug mixed mode)
#
# Error: assert(thread != 0 && thread->is_Java_thread(),"just checking")

---------------  T H R E A D  ---------------

Current thread (0x0028a718):  VMThread [id=4048]

Stack: [0x02d30000,0x02d70000),  sp=0x02d6f93c,  free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm_g.dll+0x2cad94];;  ?report_and_die@VMError@@QAEXXZ+0x3c8
V  [jvm_g.dll+0xeeb49];;  ?report_assertion_failure@@YAXPBDH0@Z+0x47
V  [jvm_g.dll+0x17c68];;  ?current@JavaThread@@SAPAV1@XZ+0x38
V  [jvm_g.dll+0x2008df];;  ?post_native_method_bind@JvmtiExport@@SAXPAVmethodOop
Desc@@PAPAE@Z+0x11
V  [jvm_g.dll+0x2299f6];;  ?set_native_function@methodOopDesc@@QAEXPAE@Z+0x5b
V  [jvm_g.dll+0x20b46e];;  ?transfer_old_native_function_registrations@VM_Redefi
neClasses@@AAEXXZ+0x84
V  [jvm_g.dll+0x20b5e2];;  ?redefine_single_class@VM_RedefineClasses@@AAEXPAV_jc
lass@@VinstanceKlassHandle@@PAVThread@@@Z+0x16e
V  [jvm_g.dll+0x207d2b];;  ?doit@VM_RedefineClasses@@UAEXXZ+0x57
V  [jvm_g.dll+0x2d6966];;  ?evaluate@VM_Operation@@QAEXXZ+0x40
V  [jvm_g.dll+0x2d5dac];;  ?evaluate_operation@VMThread@@AAEXPAVVM_Operation@@@Z
+0x19
V  [jvm_g.dll+0x2d60b8];;  ?loop@VMThread@@QAEXXZ+0x2a2
V  [jvm_g.dll+0x2d5c51];;  ?run@VMThread@@UAEXXZ+0xad
V  [jvm_g.dll+0x2445b1];;  ?_start@@YGIPAVThread@@@Z+0xa1
C  [MSVCRTD.dll+0xc323]
C  [kernel32.dll+0xb50b]

VM_Operation (0x0327f8bc): VM_RedefineClasses, mode: safepoint, requested by thr
ead 0x00299788


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x0029fbd8 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4224]
  0x0029dd48 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5732]
  0x0029cd48 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4352]
  0x00299788 JavaThread "*** Profiler Agent Special Execution Thread ***" [_thre
ad_blocked, id=4668]
  0x002967f8 JavaThread "*** Profiler Agent Special Execution Thread ***" [_thre
ad_blocked, id=4368]
  0x00295458 JavaThread "*** JFluid Monitor thread ***" [_thread_blocked, id=432
8]
  0x002921e8 JavaThread "*** Profiler Agent Communication Thread ***" [_thread_b
locked, id=4288]
  0x0028ed48 JavaThread "Finalizer" daemon [_thread_blocked, id=5464]
  0x0028da98 JavaThread "Reference Handler" daemon [_thread_blocked, id=3672]
  0x00277578 JavaThread "main" [_thread_blocked, id=808]

Other Threads:
=>0x0028a718 VMThread [id=4048]
  0x002a0778 WatcherThread [id=4316]

VM state:at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
[0x00276488/0x0000270c] Threads_lock - owner thread: 0x0028a718

Heap
 def new generation   total 576K, used 419K [0x10260000, 0x10300000, 0x10740000)
  eden space 512K,  69% used [0x10260000, 0x102b8e90, 0x102e0000)
  from space 64K,  99% used [0x102f0000, 0x102fff10, 0x10300000)
  to   space 64K,   0% used [0x102e0000, 0x102e0000, 0x102f0000)
 tenured generation   total 2892K, used 2167K [0x10740000, 0x10a13000, 0x1426000
0)
   the space 2892K,  74% used [0x10740000, 0x1095dd68, 0x1095de00, 0x10a13000)
 compacting perm gen  total 8192K, used 4337K [0x14260000, 0x14a60000, 0x1826000
0)
   the space 8192K,  52% used [0x14260000, 0x1469c440, 0x1469c600, 0x14a60000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x00411000         C:\Program Files\jdk15_04-debug\bin\java.exe
0x7c900000 - 0x7c9b0000         C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000         C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000         C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000         C:\WINDOWS\system32\RPCRT4.dll
0x10200000 - 0x10260000         C:\WINDOWS\system32\MSVCRTD.dll
0x08000000 - 0x084f6000         C:\Program Files\jdk15_04-debug\jre\bin\client\j
vm_g.dll
0x77d40000 - 0x77dd0000         C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f56000         C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000         C:\WINDOWS\system32\WINMM.dll
0x10000000 - 0x10018000         C:\WINDOWS\system32\SSMSFltr.dll
0x003f0000 - 0x003fa000         C:\Program Files\jdk15_04-debug\jre\bin\hpi_g.dl
l
0x76bf0000 - 0x76bfb000         C:\WINDOWS\system32\PSAPI.DLL
0x00980000 - 0x00990000         D:\Testing\userdir dev\lib\deployed\jdk15\window
s\profilerinterface.dll
0x00bb0000 - 0x00bc0000         C:\Program Files\jdk15_04-debug\jre\bin\verify_g
.dll
0x00bc0000 - 0x00be4000         C:\Program Files\jdk15_04-debug\jre\bin\java_g.d
ll
0x00bf0000 - 0x00c06000         C:\Program Files\jdk15_04-debug\jre\bin\zip_g.dl
l
0x02e30000 - 0x02e4b000         C:\Program Files\jdk15_04-debug\jre\bin\net_g.dl
l
0x71ab0000 - 0x71ac7000         C:\WINDOWS\system32\WS2_32.dll
0x77c10000 - 0x77c68000         C:\WINDOWS\system32\msvcrt.dll
0x71aa0000 - 0x71aa8000         C:\WINDOWS\system32\WS2HELP.dll
0x71a50000 - 0x71a8f000         C:\WINDOWS\system32\mswsock.dll
0x662b0000 - 0x66308000         C:\WINDOWS\system32\hnetcfg.dll
0x58d40000 - 0x58d47000         C:\WINDOWS\System32\wship6.dll
0x43000000 - 0x43005000         C:\Program Files\Google\Google Desktop Search\Go
ogleDesktopNetwork1.dll
0x77fe0000 - 0x77ff1000         C:\WINDOWS\system32\Secur32.dll
0x71a90000 - 0x71a98000         C:\WINDOWS\System32\wshtcpip.dll
0x02ef0000 - 0x02ef9000         C:\Program Files\jdk15_04-debug\jre\bin\manageme
nt_g.dll
0x03100000 - 0x0310a000         C:\Program Files\jdk15_04-debug\jre\bin\nio_g.dl
l

VM Arguments:
jvm_args: -agentpath:D:/Testing/userdir dev/lib/deployed/jdk15/windows/profileri
nterface.dll="D:\Testing\userdir dev\lib",5140 -Djava.security.policy=applet.pol
icy
java_command: java2d.Java2Demo

Environment Variables:
JAVA_HOME=C:\Software\jdk142
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\AT
I Technologies\ATI Control Panel;C:\Software\ant162\bin;C:\Software\cvs;C:\PROGR
A~1\ULTRAE~1;C:\Program Files\Microsoft Partner Pack\Microsoft UFD Manager\;C:\P
rogram Files\Reflection\;C:\Program Files\Microsoft Visual Studio\Common\Tools\W
inNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program File
s\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\
VC98\bin;C:\software\AppServer\bin;C:\Program Files\Microsoft Partner Pack\Micro
soft UFD Manager\;C:\Software\jad
USERNAME=Ian Formanek
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 6, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows XP Build 2600 Service Pack 2

CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse, sse2

Memory: 4k page, physical 1047344k(133144k free), swap 2520152k(1416964k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_04-b05) for windows-x86, built on Jun
  3 2005 02:15:52 by "java_re" with MS VC++ 6.0

Comments
SUGGESTED FIX See attached 6318850-webrev-cr0.tgz file for the proposed fix.
20-10-2005

SUGGESTED FIX Add a new flag option to set_native_function() and modify the callers of set_native_function() to specify whether the JVM/TI NATIVE_METHOD_BIND event is interesting or not.
19-10-2005

EVALUATION As Robert points out in the comments, RedefineClasses() use of set_native_function() should not be generating an event.
01-09-2005

EVALUATION The post_native_method_bind() routine is only called from methodOopDesc::set_native_function(). Most calls to set_native_function() are done from JavaThreads. However, the RedefineClasses() API results in a call from the VMThread via VM_RedefineClasses::transfer_old_native_function_registrations(). post_native_method_bind() assumes that its caller is a JavaThread and that is the cause of the assertion failure and likely the cause of the product bits crashes.
01-09-2005