JDK-5008824 : Eclipse sometimes crashes while debugging.
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-03-05
  • Updated: 2004-06-15
  • Resolved: 2004-06-15
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
5.0 b56Fixed
Related Reports
Relates :  
Relates :  
Description

Name: rv122619			Date: 03/05/2004

I am using Tiger Build 40 to run Eclipse 3.0M7. This type of thing has been happening since build 32. I get crash that produces the following report:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d67f4e5, pid=2412, tid=3456
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0-beta2-b40 mixed mode)
# Problematic frame:
# V  [jvm.dll+0x5f4e5]
#

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

Current thread (0x00356848):  JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=3456]

siginfo: ExceptionCode=0xc0000005, reading address 0xd8ffecf1

Registers:
EAX=0xd8ffece9, EBX=0x00a0eddc, ECX=0xd8ffecf1, EDX=0x00a0ede0
ESP=0x00dbf958, EBP=0x00dbf978, ESI=0x0521056d, EDI=0x00000000
EIP=0x6d67f4e5, EFLAGS=0x00010202

Top of Stack: (sp=0x00dbf958)
0x00dbf958:   73f5d708 6d6958a4 0000056e 00356848
0x00dbf968:   73f5d338 00356848 08200021 00000024
0x00dbf978:   00dbf9a8 6d6cedcd 00a0edd8 00355758
0x00dbf988:   73f5d6b8 6d6c9cba 73f5d6b8 00dbf9c0
0x00dbf998:   00dbf9d4 015a4f9c 009fdd01 00356848
0x00dbf9a8:   00dbf9c4 6d35421d 00355760 015a4f9c
0x00dbf9b8:   00dbf9c0 00dbfb70 00dbfb40 00dbfb70
0x00dbf9c8:   6d35ab16 00dbfb40 00dbf9e0 00000012 

Instructions: (pc=0x6d67f4e5)
0x6d67f4d5:   00 8b 44 24 04 56 8b 74 81 18 8b 46 04 8d 48 08
0x6d67f4e5:   8b 40 08 ff 50 7c 85 c0 74 05 8b 46 48 eb 02 8b 


Stack: [0x00cc0000,0x00dc0000),  sp=0x00dbf958,  free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x5f4e5]
V  [jvm.dll+0xaedcd]
C  [jdwp.dll+0x421d]
C  [jdwp.dll+0xab16]
C  [jdwp.dll+0x16bb7]
V  [jvm.dll+0xf9da2]
V  [jvm.dll+0xf9d70]
C  [MSVCRT.dll+0x27fb8]
C  [kernel32.dll+0x1d33b]


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

Java Threads: ( => current thread )
  0x031bb850 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=1736]
  0x00a25d90 JavaThread "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon [_thread_in_native, id=804]
  0x0169d410 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3172]
  0x03132cb0 JavaThread "AWT-Shutdown" [_thread_blocked, id=2812]
  0x033b7bf0 JavaThread "Worker-14" [_thread_blocked, id=860]
  0x0188c200 JavaThread "Worker-13" [_thread_blocked, id=2720]
  0x015ae9f8 JavaThread "Worker-12" [_thread_blocked, id=2180]
  0x016b2978 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3288]
  0x018b8800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1748]
  0x013ea408 JavaThread "Java indexing" daemon [_thread_blocked, id=2784]
  0x0165aae8 JavaThread "Start Level Event Dispatcher" daemon [_thread_blocked, id=2756]
  0x013fb440 JavaThread "Framework Event Dispatcher" daemon [_thread_blocked, id=3304]
  0x00a164b0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3520]
  0x00a14ac8 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3428]
  0x00a12d68 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4080]
  0x00a10f10 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=1684]
  0x00a100d0 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=3740]
=>0x00356848 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=3456]
  0x00a01058 JavaThread "Finalizer" daemon [_thread_blocked, id=3476]
  0x009ffbc8 JavaThread "Reference Handler" daemon [_thread_blocked, id=2184]
  0x00356668 JavaThread "main" [_thread_blocked, id=344]

Other Threads:
  0x009fd3b8 VMThread [id=2012]
  0x00a176d8 WatcherThread [id=3484]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 3968K, used 1766K [0x6eb40000, 0x6ef80000, 0x6f020000)
  eden space 3584K,  45% used [0x6eb40000, 0x6ecdb1d8, 0x6eec0000)
  from space 384K,  31% used [0x6ef20000, 0x6ef3e640, 0x6ef80000)
  to   space 384K,   0% used [0x6eec0000, 0x6eec0000, 0x6ef20000)
 tenured generation   total 51456K, used 41596K [0x6f020000, 0x72260000, 0x72b40000)
   the space 51456K,  80% used [0x6f020000, 0x718bf108, 0x718bf200, 0x72260000)
 compacting perm gen  total 37376K, used 37329K [0x72b40000, 0x74fc0000, 0x76b40000)
   the space 37376K,  99% used [0x72b40000, 0x74fb4428, 0x74fb4600, 0x74fc0000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x0040b000 	C:\Program Files\Java\j2re1.5.0\bin\javaw.exe
0x77f50000 - 0x77ff7000 	C:\WINNT\System32\ntdll.dll
0x77e60000 - 0x77f46000 	C:\WINNT\system32\kernel32.dll
0x77dd0000 - 0x77e5d000 	C:\WINNT\system32\ADVAPI32.dll
0x78000000 - 0x78086000 	C:\WINNT\system32\RPCRT4.dll
0x77d40000 - 0x77dcc000 	C:\WINNT\system32\USER32.dll
0x77c70000 - 0x77cb0000 	C:\WINNT\system32\GDI32.dll
0x77c10000 - 0x77c63000 	C:\WINNT\system32\MSVCRT.dll
0x6d620000 - 0x6d79d000 	C:\Program Files\Java\j2re1.5.0\bin\client\jvm.dll
0x76b40000 - 0x76b6c000 	C:\WINNT\System32\WINMM.dll
0x6d270000 - 0x6d277000 	C:\Program Files\Java\j2re1.5.0\bin\hpi.dll
0x76bf0000 - 0x76bfb000 	C:\WINNT\System32\PSAPI.DLL
0x6d350000 - 0x6d384000 	C:\Program Files\Java\j2re1.5.0\bin\jdwp.dll
0x6d5f0000 - 0x6d5fb000 	C:\Program Files\Java\j2re1.5.0\bin\verify.dll
0x6d2e0000 - 0x6d2fc000 	C:\Program Files\Java\j2re1.5.0\bin\java.dll
0x6d610000 - 0x6d61e000 	C:\Program Files\Java\j2re1.5.0\bin\zip.dll
0x6d210000 - 0x6d216000 	C:\Program Files\Java\j2re1.5.0\bin\dt_socket.dll
0x00930000 - 0x00945000 	C:\WINNT\System32\WS2_32.dll
0x00c50000 - 0x00c58000 	C:\WINNT\System32\WS2HELP.dll
0x00c60000 - 0x00c9b000 	C:\WINNT\System32\mswsock.dll
0x76f20000 - 0x76f45000 	C:\WINNT\System32\DNSAPI.dll
0x76fb0000 - 0x76fb7000 	C:\WINNT\System32\winrnr.dll
0x76f60000 - 0x76f8c000 	C:\WINNT\system32\WLDAP32.dll
0x76fc0000 - 0x76fc5000 	C:\WINNT\System32\rasadhlp.dll
0x00cb0000 - 0x00cb8000 	C:\WINNT\System32\wshtcpip.dll
0x6d490000 - 0x6d4a2000 	C:\Program Files\Java\j2re1.5.0\bin\net.dll
0x6d4b0000 - 0x6d4b8000 	C:\Program Files\Java\j2re1.5.0\bin\nio.dll
0x10000000 - 0x10048000 	C:\eclipse\plugins\org.eclipse.swt.win32_3.0.0\os\win32\x86\swt-win32-3038.dll
0x771b0000 - 0x772d1000 	C:\WINNT\system32\ole32.dll
0x77340000 - 0x773cb000 	C:\WINNT\system32\COMCTL32.dll
0x01c00000 - 0x01c45000 	C:\WINNT\system32\comdlg32.dll
0x01c50000 - 0x01cb5000 	C:\WINNT\system32\SHLWAPI.dll
0x773d0000 - 0x77bc7000 	C:\WINNT\system32\SHELL32.dll
0x77120000 - 0x771ab000 	C:\WINNT\system32\OLEAUT32.dll
0x01cc0000 - 0x01cdc000 	C:\WINNT\System32\IMM32.dll
0x01ce0000 - 0x01dc4000 	C:\WINNT\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
0x5ad70000 - 0x5ada4000 	C:\WINNT\System32\uxtheme.dll
0x01f50000 - 0x01f94000 	C:\WINNT\System32\MSCTF.dll
0x01ff0000 - 0x01ff8000 	C:\eclipse\plugins\org.eclipse.core.resources.win32_3.0.0\os\win32\x86\core_2_1_0b.dll
0x61210000 - 0x6121f000 	C:\Program Files\Microsoft Hardware\Mouse\POINT32.dll
0x021a0000 - 0x021cc000 	C:\WINNT\System32\oleacc.dll
0x55900000 - 0x55961000 	C:\WINNT\System32\MSVCP60.dll
0x02410000 - 0x02415000 	C:\WINNT\System32\msimg32.dll
0x61220000 - 0x61232000 	C:\Program Files\Microsoft Hardware\Mouse\MSH_ZWF.dll
0x6d000000 - 0x6d15f000 	C:\Program Files\Java\j2re1.5.0\bin\awt.dll
0x02c80000 - 0x02ca3000 	C:\WINNT\System32\WINSPOOL.DRV
0x02cc0000 - 0x02d04000 	C:\WINNT\System32\ddraw.dll
0x02d10000 - 0x02d16000 	C:\WINNT\System32\DCIMAN32.dll
0x02d20000 - 0x02de7000 	C:\WINNT\System32\D3DIM700.DLL
0x6d330000 - 0x6d335000 	C:\Program Files\Java\j2re1.5.0\bin\jawt.dll
0x03000000 - 0x03008000 	C:\eclipse\plugins\org.eclipse.swt.win32_3.0.0\os\win32\x86\swt-awt-win32-3038.dll
0x6d230000 - 0x6d26d000 	C:\Program Files\Java\j2re1.5.0\bin\fontmanager.dll
0x6d1b0000 - 0x6d1d2000 	C:\Program Files\Java\j2re1.5.0\bin\dcpr.dll

VM Arguments:
jvm_args: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:2861
java_command: org.eclipse.core.launcher.Main -data C:\eclipse\runtime-workspace -configuration file:C:\eclipse\workspace\.metadata\.plugins\org.eclipse.pde.core\C__eclipse_runtime-workspace\platform.cfg -dev bin -os win32 -ws win32 -arch x86 -nl en_US -showsplash c:\eclipse\eclipse -showsplash 600

Environment Variables:
PATH=C:\Perl\bin\;C:\mks\mksnt;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;c:\Tools;;C:\Program Files\PRISM;C:\Program Files\JProbe Suite 5.0.0\bin;C:\jwsdp-1.2\jwsdp-shared\bin
USERNAME=sasjaa
SHELL=C:/mks/mksnt/sh.exe
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 1 Stepping 2, GenuineIntel


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

OS: Windows XP Build 2600 Service Pack 1

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

Memory: 4k page, physical 1047564k(391572k free), swap 2519620k(1890248k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0-beta2-b40) for windows-x86, built on Feb 25 2004 01:59:20 by "java_re" with MS VC++ 6.0


======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-rc FIXED IN: tiger-rc INTEGRATED IN: tiger-b56 tiger-rc
08-07-2004

EVALUATION It would be useful if the submitter could provide a description of how the crash is duplicated or even a description of what they are doing in the debugger at the time of the crash. Also a Dr. Watson log would be useful. That said, [jvm.dll+0xaedcd] appears to be JvmtiEnv::GetMethodModifiers and given it's the listener thread it's likely it is executing a ReferenceType.Methods commands. ###@###.### 2004-03-08 Reply from submitter :- "Unfortunately I have not been able to nail it down. I am doing plugin development, creating a visual drag and drop editor similar to webAF. As such I am using Eclipse to debug eclipse running my plugin. Eclipse uses Hot Class Replacement so that I can modify code and continue running. If I modify code in a method that I am currently steping through the execution stack is popped and the method is restarted when my modifications are saved out. Where I see the problems is when I am not stopped in a method. I run the code and then modify a method that the code should not be in. I get the program back to a stable state before saving my changes. Then I rerun my test. It is here that sometimes I get the error that I sent in. So it is just a matter of using it to sense a pattern. It happened to me just yesterday. I had Ernest in here and I said "this will probably crash now" and sure enough..." Based on this information it's possible that the hotswap is causing a stale jmethodID to be passed into JVMTI. This would tally with the stack trace in the err file. ###@###.### 2004-03-09 The RedefineClasses implementation as been updated in b46 to fix a number of problems identified when redefining the core classes - see 5009159. ###@###.### 2004-03-30 =============================== I used Mingyao's Windows version of hs_err script and SDK b40 to translate hs_err crash dump (provided in the bug report). This script doesn't translate jdwp.ldd frames because jdwp.map is not normally built. Jim gave me an idea to use URSoft W32Dasm to disassemble jdwp.ldd and to discover what jdwp frames are on the stack. So, this is full tsack trace of this crash below: Stack: [0x00cc0000,0x00dc0000), sp=0x00dbf958, free space=1022k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [jvm.dll+0x5f4e5] constantPoolOopDesc::klass_name_at @@QAEPAVsymbolOopDesc@@H@Z+0xf ?? [Missed frame ] instanceKlass::compute_modifier_flags(JavaThread*) V [jvm.dll+0xaedcd] JvmtiEnv::GetClassModifiers @@QAE?AW4jvmtiError@@PAVoopDesc@@PAH@Z+0x3f C [jdwp.dll+0x421d] modifiers(PacketInputStream *in, PacketOutputStream *out) C [jdwp.dll+0xab16] debugLoop_run(void) ?? [Missed frame ] connectionInitiated() C [jdwp.dll+0x16bb7] attachThread(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) V [jvm.dll+0xf9da2] JavaThread::thread_main_inner @@QAEXXZ+0x30 V [jvm.dll+0xf9d70] JavaThread::run @@QAEXXZ+0x7d C [MSVCRT.dll+0x27fb8] C [kernel32.dll+0x1d33b] Some frames are missed in this stack trace which is suspisious a little bit. The following is analysis made by Tom Rodriguez: > Date: Fri, 07 May 2004 11:24:28 -0700 > From: Tom Rodriguez <###@###.###> > Subject: Re: windows hs_err > To: Jim Holmlund <###@###.###> > Cc: Serguei Spitsyn <###@###.###> > > > Stack: [0x00cc0000,0x00dc0000), sp=0x00dbf958, free space=1022k > > Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) > > V [jvm.dll+0x5f4e5] constantPoolOopDesc::klass_name_at()+0xf > > V [jvm.dll+0xaedcd] JvmtiEnv::GetClassModifiers()+0x3f > > C [jdwp.dll+0x421d] modifiers(PacketInputStream *in, PacketOutputStream *out) > > C [jdwp.dll+0xab16] debugLoop_run() > > C [jdwp.dll+0x16bb7] attachThread(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) > > -> connectionInitiated() (looks like this function has been inlined) > > V [jvm.dll+0xf9da2] JavaThread::thread_main_inner()+0x30 > > V [jvm.dll+0xf9d70] JavaThread::run()+0x7d > > C [MSVCRT.dll+0x27fb8] > > C [kernel32.dll+0x1d33b] > > > > > > In the above, GetClassModifiers doesn't call klass_name_at() - > > it calls an ik method that in turn calls klass_name_at(). > > So that stack is suspicious. > > On intel. stack frames sometime get hidden so I wouldn't be that > suspicious of it particularly since it largely correspond to how it > should execute minus a frame or two. > > The reason for the crash is that the _inner_classes field of the new > instanceKlass isn't being moved to the original instanceKlass during > redefinition. This leaves the old one around with indices into the old > constant pool. You'll also need to transfer the annotations fields. > > And: > > u2 _enclosing_method_class_index; // Constant pool > index for class of enclosing method, or 0 > if none > u2 _enclosing_method_method_index; // C > > I'd be suspicious of any typeArrayOop or u2 in instanceKlass. The > fields are handled properly and that's the only other thing I'd be > suspicious of. > > One thing that's not clear to me is whether you should allow the inner > classes attributes to change their contents. Same with the annotations. > I suspect that it might be best to require them to be EMCP. This > might help avoid mismatches that we wouldn't be able to handle. > > Also as far as annotations go I think there may be a problem here. The > vm passes a copy of the annotation attribute up into Java code which > then parses it by direct access to the constant pool. So if a > redefinition occurs during a parse of the annotations for a class could > end up reading the wrong attribute. The VM code seems to have enough > sanity checking that I don't think we'd crash. We'd just through an > IllegalArgumentException for the bad access and the annotation parsing > will fail. That's not a big deal. > > So basically if you update the fields I've pointed out I think you'll be > ok crashwise. It shouldn't be that hard to produce a test case which > caused this to occur either. > > tom So, I'm working to reproduce this crash by playing with inner classes in class redefinitions. NOTE ==== I agree with Alan that it would be very helpful if the user can provide some additional input (see my comment). ###@###.### 2004-05-10 =============================== I have done some investigation and found that Tom is 100% right. And now, I'm able to reproduce this bug on any platform including Solaris. (1) The following tests crashes JVM with the same failure mode: ------------------------------------------------------------- #!/bin/sh # @test %W% %E% # @bug 5008824: # @summary Eclipse sometimes crashes while debugging. # @author Jim Holmlund # @author Serguei Spitsyn # # @run shell RedefineInnerClassTest2.sh.sh # createJavaFile() { cat <<EOF > $1.java.1 public class $1 { static public void main(String[] args) { Class ik_g = $1.class; //@1 breakpoint int mods = ik_g.getModifiers(); //@1 delete } class nested1 {} } EOF } dojdbCmds() { setBkpts @1 runToBkpt cmd redefine 'shtest' $TESTCLASSES/'vers2/shtest.class' cmd cont cmd quit } mysetup() { if [ -z "$TESTSRC" ] ; then TESTSRC=. fi for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then . $ii/ShellScaffold.sh break fi done } # You could replace this next line with the contents # of ShellScaffold.sh and this script will run just the same. mysetup runit ------------------------------------------------------------------ (2) This is the test run log shoing the crash below: ------------------------------------------------------------------ SDK_BLD = /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0 /net/jano.sfbay/export/disk20/serviceability/tools/bin/runregress -no -jdk /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0 -o /net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21 RedefineInnerClassTest2.sh -d -showversion runregress: Version 05/12/04 Will use -showversion in /net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/@debuggeeVMOptions export CLASSPATH CLASSPATH=/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/classes:/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/lib/tools.jar:./scaffold:/net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes:/net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi:.. -- DEBUG version 2 of ShellScaffold.sh --Compiling first version of /net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/aa228994/shtest.java with options: compiling shtest.java --Compiling second version of /net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/aa228994/shtest.java with --Starting jdb, address= CompilerOracle: exclude java/util/Collections$UnmodifiableCollection$1 <init> Listening at address: tomsk:41379 --Starting debuggee Cmd: /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/bin/java -classpath /net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/aa228994 -DHANGINGJAVA-228994_DEB -Djtreg.classDir=/net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/aa228994 -showversion -agentlib:jdwp=transport=dt_socket,address=41379,server=n,suspend=y shtest CompilerOracle: exclude java/util/Collections$UnmodifiableCollection$1 <init> Set uncaught java.lang.Throwable Set deferred uncaught java.lang.Throwable Initializing jdb ... > VM Started: No frames on the current call stack main[1] stop at shtest:4 Deferring breakpoint shtest:4. It will be set after the class is loaded. main[1] run > java version "1.5.0-beta2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b50) Java HotSpot(TM) Client VM (build 1.5-internal-debug, mixed mode) Set deferred breakpoint shtest:4 Breakpoint hit: "thread=main", shtest.main(), line=4 bci=0 4 Class ik_g = shtest.class; //@1 breakpoint main[1] redefine shtest /net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/aa228994/vers2/shtest.class ss45998 tracing: VM_RedefineClasses::load_new_class_versions(): shtest redefine_single_class: Replace inner_classes main[1] cont ss45998 tracing: constantPoolOopDesc::klass_name_at(): tag_at(5).value()=1, class name=shtest # To suppress the following error report, specify this argument # after -XX: or in .hotspotrc: SuppressErrorAt=/constantPoolOop.cpp:237] # # An unexpected error has been detected by HotSpot Virtual Machine: # # Internal Error (/net/tomsk.sfbay/export/home/ss45998/1.5/hs/src/share/vm/oops/constantPoolOop.cpp, 237), pid=229040, tid=1 # # Java VM: Java HotSpot(TM) Client VM (1.5-internal-debug mixed mode) # # Error: assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass(),"Corrupted constant pool") > # An error report file with more information is saved as hs_err_pid229040.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # Current thread is 1 Dumping core ... ------------------------------------------------------------------ (3) The following is hs_err crash dump: ------------------------------------------------------------------ ss45998@tomsk hs_err hs_err_pid229040.log # # An unexpected error has been detected by HotSpot Virtual Machine: # # Internal Error (/net/tomsk.sfbay/export/home/ss45998/1.5/hs/src/share/vm/oops/constantPoolOop.cpp, 237), pid=229040, tid=1 # # Java VM: Java HotSpot(TM) Client VM (1.5-internal-debug mixed mode) # # Error: assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass(),"Corrupted constant pool") --------------- T H R E A D --------------- Current thread (0x0808bd10): JavaThread "main" [_thread_in_vm, id=1] Stack: [0x08007000,0x08048000), sp=0x08046704, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x6266f2] ;; void VMError::report_and_die()+0x420 V [libjvm.so+0x1f36e8] ;; void report_assertion_failure(const char*,int,const char*)+0x58 V [libjvm.so+0x1ed9f3] ;; symbolOopDesc*constantPoolOopDesc::klass_name_at(int)+0x54e V [libjvm.so+0x2472a2] ;; int instanceKlass::compute_modifier_flags(Thread*)const+0x1b2 V [libjvm.so+0x31a255] ;; JVM_GetClassModifiers+0x265 j java.lang.Class.getModifiers()I+0 j shtest.main([Ljava/lang/String;)V+5 v ~StubRoutines::call_stub V [libjvm.so+0x27fd5f] ;; void JavaCalls::call_helper(JavaValue*,methodHandle*,JavaCallArguments*,Thread*)+0x28b V [libjvm.so+0x537228] ;; void os::os_exception_wrapper(void(*)(JavaValue*,methodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallArguments*,Thread*)+0x14 V [libjvm.so+0x27facf] ;; void JavaCalls::call(JavaValue*,methodHandle,JavaCallArguments*,Thread*)+0x7f V [libjvm.so+0x297fdb] ;; void jni_invoke_static(JNIEnv_*,JavaValue*,_jobject*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x1b7 V [libjvm.so+0x2b6588] ;; jni_CallStaticVoidMethod+0x298 C [java+0x26ce] main+0xa4c C [java+0x1bea] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j java.lang.Class.getModifiers()I+0 j shtest.main([Ljava/lang/String;)V+5 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x081a5280 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=10] 0x081a0ec8 JavaThread "CompilerThread0" daemon [_thread_blocked, id=9] 0x0819eb68 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=8] 0x0819c470 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=7] 0x0819b170 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=6] 0x08198dd8 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=5] 0x08170cb8 JavaThread "Finalizer" daemon [_thread_blocked, id=4] 0x0816fca8 JavaThread "Reference Handler" daemon [_thread_blocked, id=3] =>0x0808bd10 JavaThread "main" [_thread_in_vm, id=1] Other Threads: 0x0816a0d0 VMThread [id=2] 0x081a7180 WatcherThread [id=11] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 183K [0xb8400000, 0xb84a0000, 0xb88e0000) eden space 512K, 35% used [0xb8400000, 0xb842ddd0, 0xb8480000) from space 64K, 0% used [0xb8480000, 0xb8480000, 0xb8490000) to space 64K, 0% used [0xb8490000, 0xb8490000, 0xb84a0000) tenured generation total 1408K, used 0K [0xb88e0000, 0xb8a40000, 0xbc400000) the space 1408K, 0% used [0xb88
08-07-2004

SUGGESTED FIX ###@###.### 2004-05-21 The field _inner_classes, different kind of annotations fields and maybe some other typeArrayOop or u2 fields have to be swapped between old and new version of instanceKlass. Also, the following fragment is nissed in the redefineClasses(): void VM_RedefineClasses::patch_indexes_for_fields(instanceKlassHandle k_h, instanceKlassHandle k_h_new) { ... k_fields->short_at_put( i + instanceKlass::generic_signature_offset, k_new_fields->short_at(i + instanceKlass::generic_signature_offset) ); } } ###@###.### 2004-06-02 This is result of discussion with Tom Rodriguez and Jim Holmlund below on what IK fields are currently missed in HotSwap algorithm. We need to swap the following field values between old and new version of instanceKlass at RedefineClasses(): // typeArrayOop _inner_classes; Comment: Discussed that we need to create some testcases to check how does this work for anonymous classes. Variants: - non-EMCP checks for old methods - verifier can provide some checking - to allow only EMCP inner classes to be redefiend (?) // u2 _major_version; // typeArrayOop _class_annotations; // objArrayOop _fields_annotations; // objArrayOop _methods_annotations; // objArrayOop _methods_parameter_annotations; // objArrayOop _methods_default_annotations; Comment: Allowing to add/remove annotations is save from crash standpoint but can be not safe for accuracy of information. // u2 _enclosing_method_class_index; // u2 _enclosing_method_method_index; ###@###.### 2004-06-08 Webrev at: http://javaweb.sfbay/~ss45998/webrev/eclipse.Jun7.1/ The contextual diffs are: % sccs sccsdiff -c -r1.20 -r1.21 jvmtiRedefineClasses.cpp ------- jvmtiRedefineClasses.cpp ------- *** /tmp/geta13364 Tue Jun 8 17:56:12 2004 --- /tmp/getb13364 Tue Jun 8 17:56:12 2004 *************** *** 105,110 **** --- 105,116 ---- } } + // Check whether class is in the error init state. + if (k_h_old->is_in_error_state()) { + // TBD #5057930: special error code is needed in 1.6 + return JVMTI_ERROR_INVALID_CLASS; + } + // Check whether class modifiers are the same. jushort old_flags = (jushort) k_h_old->access_flags().get_flags(); jushort new_flags = (jushort) k_h_new->access_flags().get_flags(); *************** *** 282,287 **** --- 288,297 ---- i + instanceKlass::signature_index_offset, k_new_fields->short_at(i + instanceKlass::signature_index_offset) ); + k_fields->short_at_put( + i + instanceKlass::generic_signature_offset, + k_new_fields->short_at(i + instanceKlass::generic_signature_offset) + ); } } *************** *** 364,370 **** } } - // Install the redefinition of a class -- // The original instanceKlass object (k_h) always represents the latest // version of the respective class. However, during class redefinition we swap --- 374,379 ---- *************** *** 375,380 **** --- 384,390 ---- // methods (taken from k_h) attached to it. k_h links to k_h_new to create a // linked list of class versions. void VM_RedefineClasses::redefine_single_class(jclass j_clazz, instanceKlassHandle k_h_new, TRAPS) { + oop mirror = JNIHandles::resolve_non_null(j_clazz); klassOop k_oop = java_lang_Class::as_klassOop(mirror); instanceKlassHandle k_h = instanceKlassHandle(THREAD, k_oop); *************** *** 405,411 **** // Replace methods and constantpool k_h->set_methods(_new_methods); k_h_new->set_methods(_old_methods); // To prevent potential GCing of the old methods, ! // and to be able to undo operation easily. constantPoolOop old_constants = k_h->constants(); k_h->set_constants(k_h_new->constants()); --- 415,421 ---- // Replace methods and constantpool k_h->set_methods(_new_methods); k_h_new->set_methods(_old_methods); // To prevent potential GCing of the old methods, ! // and to be able to undo operation easily. constantPoolOop old_constants = k_h->constants(); k_h->set_constants(k_h_new->constants()); *************** *** 414,419 **** --- 424,434 ---- check_methods_and_mark_as_old(); transfer_old_native_function_registrations(); + // Replace inner_classes + typeArrayOop old_inner_classes = k_h->inner_classes(); + k_h->set_inner_classes(k_h_new->inner_classes()); + k_h_new->set_inner_classes(old_inner_classes); + // Initialize the vtable and interface table after // methods have been rewritten { ResourceMark rm(THREAD); *************** *** 440,446 **** --- 455,497 ---- k_h->set_access_flags(flags); } + // Replace class annotation fields values + typeArrayOop old_class_annotations = k_h->class_annotations(); + k_h->set_class_annotations(k_h_new->class_annotations()); + k_h_new->set_class_annotations(old_class_annotations); + // Replace fields annotation fields values + objArrayOop old_fields_annotations = k_h->fields_annotations(); + k_h->set_fields_annotations(k_h_new->fields_annotations()); + k_h_new->set_fields_annotations(old_fields_annotations); + + // Replace methods annotation fields values + objArrayOop old_methods_annotations = k_h->methods_annotations(); + k_h->set_methods_annotations(k_h_new->methods_annotations()); + k_h_new->set_methods_annotations(old_methods_annotations); + + // Replace methods parameter annotation fields values + objArrayOop old_methods_parameter_annotations = k_h->methods_parameter_annotations(); + k_h->set_methods_parameter_annotations(k_h_new->methods_parameter_annotations()); + k_h_new->set_methods_parameter_annotations(old_methods_parameter_annotations); + + // Replace methods default annotation fields values + objArrayOop old_methods_default_annotations = k_h->methods_default_annotations(); + k_h->set_methods_default_annotations(k_h_new->methods_default_annotations()); + k_h_new->set_methods_default_annotations(old_methods_default_annotations); + + // Replace major version number of class file + u2 old_major_version = k_h->major_version(); + k_h->set_major_version(k_h_new->major_version()); + k_h_new->set_major_version(old_major_version); + + // Replace CP indexes for class and name+type of enclosing method + u2 old_class_idx = k_h->enclosing_method_class_index(); + u2 old_method_idx = k_h->enclosing_method_method_index(); + k_h->set_enclosing_method_indices(k_h_new->enclosing_method_class_index(), + k_h_new->enclosing_method_method_index()); + k_h_new->set_enclosing_method_indices(old_class_idx, old_method_idx); + // Maintain a linked list of versions of this class. // List is in ascending age order. Current version (k_h) is the head. if (k_h->has_previous_version()) {
08-07-2004

EVALUATION e0000, 0xb88e0000, 0xb88e0200, 0xb8a40000) compacting perm gen total 8192K, used 1423K [0xbc400000, 0xbcc00000, 0xc0400000) the space 8192K, 17% used [0xbc400000, 0xbc563d70, 0xbc563e00, 0xbcc00000) No shared spaces configured. Dynamic libraries: 0x08050000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/bin/java 0xc7b90000 /lib/libthread.so.1 0xc7bb0000 /lib/libdl.so.1 0xc7ab0000 /lib/libc.so.1 0xc6800000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/client/libjvm.so 0xc7a90000 /lib/libsocket.so.1 0xc7a70000 /usr/lib/libsched.so.1 0xc7a30000 /usr/lib/libCrun.so.1 0xc7a10000 /usr/lib/libm.so.1 0xc7970000 /lib/libnsl.so.1 0xc7b70000 /lib/libw.so.1 0xc7930000 /lib/libmp.so.2 0xc78d0000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/native_threads/libhpi.so 0xc7880000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/libjdwp.so 0xc7850000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/libverify.so 0xc7800000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/libjava.so 0xc77d0000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/libzip.so 0xc6550000 /net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/libdt_socket.so 0xc6530000 /lib/nss_nis.so.1 VM Arguments: jvm_args: -DHANGINGJAVA-228994_DEB -Djtreg.classDir=/net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi/aa228994 -agentlib:jdwp=transport=dt_socket,address=41379,server=n,suspend=y java_command: shtest Environment Variables: CLASSPATH=/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/classes:/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/lib/tools.jar:./scaffold:/net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes:/net/tomsk.sfbay/export/home/ss45998/1.5/tst/regr2/b50.May21.solaris-i586/JTwork/classes/com/sun/jdi:.. PATH=/java/devtools/i386/SUNWspro/SOS8/bin:/home/ss45998/bin:/export/home/ss45998/bin/intel-S2:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/dist/local/exe:/usr/dt/bin:/usr/openwin/bin:/usr/dist/exe:/java/devtools/i386/SUNWspro/SOS8/bin:/java/devtools/i386/bin:/usr/dist/share/forte_dev_i386/SUNWspro/bin:/usr/lib:/usr/ucb:/sbin:/etc:. LD_LIBRARY_PATH=/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386/client:/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/lib/i386:/net/tomsk.sfbay/export/home/ss45998/1.5/b50/i386/jdk1.5.0/jre/../lib/i386:/usr/openwin/lib:/usr/dt/lib SHELL=/bin/csh DISPLAY=bratsk:0.0 OS=solaris --------------- S Y S T E M --------------- OS: Solaris 10 s10_29 X86 Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms. Assembled 03 March 2003 uname:SunOS 5.10 d10_34 i86pc (T2 libthread) rlimit: STACK 8480k, CORE infinity, NOFILE 65536, AS infinity load average:0.51 0.18 0.08 CPU:total 1 family 15, cmov, cx8, fxsr, mmx, ht Memory: 4k page, physical 491068k(254524k free) vm_info: Java HotSpot(TM) Client VM (1.5-internal) for solaris-x86, built on May 14 2004 15:45:26 by unknown with unknown Workshop:0x550 ------------------------------------------------------------------ (4) This is representation of original shtest.class classfile: ------------------------------------------------------------------ class shtest { 0xCAFEBABE; 0; // minor version 49; // version [] { // Constant Pool ; // first element is empty Method #4 #16; // #1 class #17; // #2 Method #18 #19; // #3 class #20; // #4 class #21; // #5 Utf8 "nested1"; // #6 Utf8 "InnerClasses"; // #7 Utf8 "<init>"; // #8 Utf8 "()V"; // #9 Utf8 "Code"; // #10 Utf8 "LineNumberTable"; // #11 Utf8 "main"; // #12 Utf8 "([Ljava/lang/String;)V"; // #13 Utf8 "SourceFile"; // #14 Utf8 "shtest.java"; // #15 NameAndType #8 #9; // #16 Utf8 "shtest"; // #17 class #22; // #18 NameAndType #23 #24; // #19 Utf8 "java/lang/Object"; // #20 Utf8 "shtest$nested1"; // #21 Utf8 "java/lang/Class"; // #22 Utf8 "getModifiers"; // #23 Utf8 "()I"; // #24 } // Constant Pool 0x0021; // access #2;// this_cpx #4;// super_cpx [] { // Interfaces } // Interfaces [] { // fields } // fields [] { // methods { // Member 0x0001; // access #8; // name_cpx #9; // sig_cpx [] { // Attributes Attr(#10) { // Code 1; // max_stack 1; // max_locals Bytes[]{ 0x2AB70001B1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#11) { // LineNumberTable [] { // LineNumberTable 0 2; 4 8; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member 0x0009; // access #12; // name_cpx #13; // sig_cpx [] { // Attributes Attr(#10) { // Code 1; // max_stack 3; // max_locals Bytes[]{ 0x1300024C2BB60003; 0x3DB1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#11) { // LineNumberTable [] { // LineNumberTable 0 5; 4 6; 9 7; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member } // methods [] { // Attributes Attr(#14) { // SourceFile #15; } // end SourceFile ; Attr(#7) { // InnerClasses [] { // InnerClasses #5 #2 #6 0; } } // end InnerClasses } // Attributes } // end class shtest ---------------------------------------------------------------------- (5) This is redefined version of the shtest.class classfile: ---------------------------------------------------------------------- class shtest { 0xCAFEBABE; 0; // minor version 49; // version [] { // Constant Pool ; // first element is empty Method #3 #15; // #1 class #16; // #2 class #17; // #3 class #18; // #4 Utf8 "nested1"; // #5 Utf8 "InnerClasses"; // #6 Utf8 "<init>"; // #7 Utf8 "()V"; // #8 Utf8 "Code"; // #9 Utf8 "LineNumberTable"; // #10 Utf8 "main"; // #11 Utf8 "([Ljava/lang/String;)V"; // #12 Utf8 "SourceFile"; // #13 Utf8 "shtest.java"; // #14 NameAndType #7 #8; // #15 Utf8 "shtest"; // #16 Utf8 "java/lang/Object"; // #17 Utf8 "shtest$nested1"; // #18 } // Constant Pool 0x0021; // access #2;// this_cpx #3;// super_cpx [] { // Interfaces } // Interfaces [] { // fields } // fields [] { // methods { // Member 0x0001; // access #7; // name_cpx #8; // sig_cpx [] { // Attributes Attr(#9) { // Code 1; // max_stack 1; // max_locals Bytes[]{ 0x2AB70001B1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#10) { // LineNumberTable [] { // LineNumberTable 0 2; 4 7; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member 0x0009; // access #11; // name_cpx #12; // sig_cpx [] { // Attributes Attr(#9) { // Code 1; // max_stack 2; // max_locals Bytes[]{ 0x1300024CB1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#10) { // LineNumberTable [] { // LineNumberTable 0 5; 4 6; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member } // methods [] { // Attributes Attr(#13) { // SourceFile #14; } // end SourceFile ; Attr(#6) { // InnerClasses [] { // InnerClasses #4 #2 #5 0; } } // end InnerClasses } // Attributes } // end class shtest class shtest { 0xCAFEBABE; 0; // minor version 49; // version [] { // Constant Pool ; // first element is empty Method #3 #15; // #1 class #16; // #2 class #17; // #3 class #18; // #4 Utf8 "nested1"; // #5 Utf8 "InnerClasses"; // #6 Utf8 "<init>"; // #7 Utf8 "()V"; // #8 Utf8 "Code"; // #9 Utf8 "LineNumberTable"; // #10 Utf8 "main"; // #11 Utf8 "([Ljava/lang/String;)V"; // #12 Utf8 "SourceFile"; // #13 Utf8 "shtest.java"; // #14 NameAndType #7 #8; // #15 Utf8 "shtest"; // #16 Utf8 "java/lang/Object"; // #17 Utf8 "shtest$nested1"; // #18 } // Constant Pool 0x0021; // access #2;// this_cpx #3;// super_cpx [] { // Interfaces } // Interfaces [] { // fields } // fields [] { // methods { // Member 0x0001; // access #7; // name_cpx #8; // sig_cpx [] { // Attributes Attr(#9) { // Code 1; // max_stack 1; // max_locals Bytes[]{ 0x2AB70001B1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#10) { // LineNumberTable [] { // LineNumberTable 0 2; 4 6; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member 0x0009; // access #11; // name_cpx #12; // sig_cpx [] { // Attributes Attr(#9) { // Code 1; // max_stack 2; // max_locals Bytes[]{ 0x1300024CB1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#10) { // LineNumberTable [] { // LineNumberTable 0 4; 4 5; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member } // methods [] { // Attributes Attr(#13) { // SourceFile #14; } // end SourceFile ; Attr(#6) { // InnerClasses [] { // InnerClasses #4 #2 #5 0; } } // end InnerClasses } // Attributes } // end class shtest class shtest { 0xCAFEBABE; 0; // minor version 49; // version [] { // Constant Pool ; // first element is empty Method #3 #15; // #1 class #16; // #2 class #17; // #3 class #18; // #4 Utf8 "nested1"; // #5 Utf8 "InnerClasses"; // #6 Utf8 "<init>"; // #7 Utf8 "()V"; // #8 Utf8 "Code"; // #9 Utf8 "LineNumberTable"; // #10 Utf8 "main"; // #11 Utf8 "([Ljava/lang/String;)V"; // #12 Utf8 "SourceFile"; // #13 Utf8 "shtest.java"; // #14 NameAndType #7 #8; // #15 Utf8 "shtest"; // #16 Utf8 "java/lang/Object"; // #17 Utf8 "shtest$nested1"; // #18 } // Constant Pool 0x0021; // access #2;// this_cpx #3;// super_cpx [] { // Interfaces } // Interfaces [] { // fields } // fields [] { // methods { // Member 0x0001; // access #7; // name_cpx #8; // sig_cpx [] { // Attributes Attr(#9) { // Code 1; // max_stack 1; // max_locals Bytes[]{ 0x2AB70001B1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#10) { // LineNumberTable [] { // LineNumberTable 0 2; 4 6; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member 0x0009; // access #11; // name_cpx #12; // sig_cpx [] { // Attributes Attr(#9) { // Code 1; // max_stack 2; // max_locals Bytes[]{ 0x1300024CB1; }; [] { // Traps } // end Traps [] { // Attributes Attr(#10) { // LineNumberTable [] { // LineNumberTable 0 4; 4 5; } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member } // methods [] { // Attributes Attr(#13) { // SourceFile #14; } // end SourceFile ; Attr(#6) { // InnerClasses [] { // InnerClasses #4 #2 #5 0; } } // end InnerClasses } // Attributes } // end class shtest ---------------------------------------------------------------------- (6) The most important difference between original and redefined version of classfile is: % diff shtest.1.jdec shtest.2.jdec ... < [] { // InnerClasses < #5 #2 #6 0; --- > [] { // InnerClasses > #4 #2 #5 0; As redefineClasses now don't swap this attribute between old and new version of shtest instanceKlass then we have wrong old indexes into new version of constant pool and wrong new indexes into old version of CP. Old class has new InnerClasses attr: #4 #2 #5 0; But we can see the crash only if we really try to use these indexes from incorrect InnerClasses attr. So, to see the crash we have to invoke getModifiers() or some similar things like reflection API. (7) This bug must be fixed in Tiger FCS. In order to fix it redefineClasses has to swap _inner_classes field between old and new version of the class. Also, as Tom said, we have to check other typeArrayOop or u2 fields in instanceKlass if they need to swapped too. A good example is annotations. ###@###.### 2004-05-21
21-05-2004