JDK-8007420 : add test for 6805864 to com/sun/jdi, add test for 7182152 to java/lang/instrument
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-02-01
  • Updated: 2014-01-15
  • Resolved: 2013-02-11
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 8
8 b78Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Add the following test:

    com/sun/jdi/RedefineAbstractClass.sh

to cover the failure mode described by the following bug fix:

    6805864 Problem with jvmti->redefineClasses: some methods
                   don't get redefined

Add the following test:

    java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh

to cover the failure mode fixed by the following bug fix:

    7182152 Instrumentation hot swap test incorrect monitor count

Comments
Add Code Review Round [0-2] webrevs for JDK8-T&L version of tests.
11-02-2013

And here is what a passing run of the test looks like: ----------System.out:(38/2632)---------- INFO: building the replacement classes. INFO: launching RedefineSubclassWithTwoInterfacesApp INFO: <begin output.log> Hello from RedefineSubclassWithTwoInterfacesAgent! isRedefineClassesSupported()=true java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b75) Java HotSpot(TM) Client VM (build 25.0-b18-7182152_exp_hsx25_dcubed-product, mixed mode) Hello from RedefineSubclassWithTwoInterfacesApp! RedefineSubclassWithTwoInterfacesApp: echo1 mesg='intf1<echo: (version-0) <test message #1.1>>' before any redefines RedefineSubclassWithTwoInterfacesApp: echo2 mesg='intf2<echo: (version-0) <test message #2.1>>' before any redefines Reading test class from RedefineSubclassWithTwoInterfacesImpl_1.class RedefineClasses-0x1: loading name=RedefineSubclassWithTwoInterfacesImpl kind=102 (avail_mem=1070872K) RedefineClasses-0x1: loaded name=RedefineSubclassWithTwoInterfacesImpl (avail_mem=1070852K) RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesImpl RedefineClasses-0x1: redefined name=RedefineSubclassWithTwoInterfacesImpl, count=1 (avail_mem=1070832K) RedefineClasses-0x4000: calling check_class RedefineClasses-0x4: vm_op: all=0 prologue=0 doit=0 RedefineClasses-0x4: redefine_single_class: phase1=0 phase2=0 Reading test class from RedefineSubclassWithTwoInterfacesTarget_1.class RedefineClasses-0x1: loading name=RedefineSubclassWithTwoInterfacesTarget kind=102 (avail_mem=1070544K) RedefineClasses-0x1: loaded name=RedefineSubclassWithTwoInterfacesTarget (avail_mem=1070528K) RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesTarget RedefineClasses-0x100000: vtable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x200000: itable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x200000: itable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x1: redefined name=RedefineSubclassWithTwoInterfacesTarget, count=1 (avail_mem=1070528K) RedefineClasses-0x4000: calling check_class RedefineClasses-0x4: vm_op: all=0 prologue=0 doit=0 RedefineClasses-0x4: redefine_single_class: phase1=0 phase2=0 RedefineSubclassWithTwoInterfacesApp: echo1 mesg='intf1<echo: (version-1) <test message #1.2>>' after redefine RedefineSubclassWithTwoInterfacesApp: echo2 mesg='intf2<echo: (version-1) <test message #2.2>>' after redefine INFO: <end output.log> INFO: did NOT find 'guarantee' in the test output. INFO: found 2 version-0 'before any redefines' mesgs. INFO: found 2 version-1 'after redefine' mesgs. PASS: test passed both positive and negative output checks. ----------System.err:(0/0)---------- result: Passed. Execution successful test result: Passed. Execution successful These are the key lines in the trace output: RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesTarget RedefineClasses-0x100000: vtable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x200000: itable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x200000: itable method update: echo((Ljava/lang/String;)Ljava/lang/String;) 1 vtable update and 2 itable updates!
06-02-2013

Here is what the current RedefineSubclassWithTwoInterfaces test failure looks like when the TraceRedefineClasses option is _not_ used: ----------System.out:(23/1481)---------- INFO: building the replacement classes. INFO: launching RedefineSubclassWithTwoInterfacesApp INFO: <begin output.log> Hello from RedefineSubclassWithTwoInterfacesAgent! isRedefineClassesSupported()=true java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b75) Java HotSpot(TM) Client VM (build 25.0-b18-7182152_exp_hsx25_dcubed-product, mixed mode) Hello from RedefineSubclassWithTwoInterfacesApp! RedefineSubclassWithTwoInterfacesApp: echo1 mesg='intf1<echo: (version-0) <test message #1.1>>' before any redefines RedefineSubclassWithTwoInterfacesApp: echo2 mesg='intf2<echo: (version-0) <test message #2.1>>' before any redefines Reading test class from RedefineSubclassWithTwoInterfacesImpl_1.class Reading test class from RedefineSubclassWithTwoInterfacesTarget_1.class RedefineSubclassWithTwoInterfacesApp: echo1 mesg='intf1<echo: (version-1) <test message #1.2>>' after redefine RedefineSubclassWithTwoInterfacesApp: echo2 mesg='intf2<echo: (version-0) <test message #2.2>>' after redefine INFO: <end output.log> INFO: did NOT find 'guarantee' in the test output. INFO: found 2 version-0 'before any redefines' mesgs. FAIL: did NOT find 2 version-1 'after redefine' mesgs. INFO: grep 'after redefine' output: RedefineSubclassWithTwoInterfacesApp: echo1 mesg='intf1<echo: (version-1) <test message #1.2>>' after redefine RedefineSubclassWithTwoInterfacesApp: echo2 mesg='intf2<echo: (version-0) <test message #2.2>>' after redefine ----------System.err:(0/0)---------- result: Failed. Execution failed: exit code 1 test result: Failed. Execution failed: exit code 1
06-02-2013

Revising the RedefineSubclassWithTwoInterfaces test based on code review feedback. Here is what the current test output looks like when the guarantee fails: ----------System.out:(63/4319)*---------- INFO: building the replacement classes. INFO: launching RedefineSubclassWithTwoInterfacesApp INFO: <begin output.log> Hello from RedefineSubclassWithTwoInterfacesAgent! isRedefineClassesSupported()=true java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b75) Java HotSpot(TM) Client VM (build 25.0-b18-7182152_exp_hsx25_dcubed-product, mixed mode) Hello from RedefineSubclassWithTwoInterfacesApp! RedefineSubclassWithTwoInterfacesApp: echo1 mesg='intf1<echo: (version-0) <test message #1.1>>' before any redefines RedefineSubclassWithTwoInterfacesApp: echo2 mesg='intf2<echo: (version-0) <test message #2.1>>' before any redefines Reading test class from RedefineSubclassWithTwoInterfacesImpl_1.class RedefineClasses-0x1: loading name=RedefineSubclassWithTwoInterfacesImpl kind=102 (avail_mem=1084200K) RedefineClasses-0x1: loaded name=RedefineSubclassWithTwoInterfacesImpl (avail_mem=1084176K) RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesImpl RedefineClasses-0x1: redefined name=RedefineSubclassWithTwoInterfacesImpl, count=1 (avail_mem=1084156K) RedefineClasses-0x4000: calling check_class RedefineClasses-0x4: vm_op: all=1 prologue=1 doit=0 RedefineClasses-0x4: redefine_single_class: phase1=0 phase2=0 Reading test class from RedefineSubclassWithTwoInterfacesTarget_1.class RedefineClasses-0x1: loading name=RedefineSubclassWithTwoInterfacesTarget kind=102 (avail_mem=1083948K) RedefineClasses-0x1: loaded name=RedefineSubclassWithTwoInterfacesTarget (avail_mem=1083932K) RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesTarget RedefineClasses-0x100000: vtable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x200000: itable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x1: redefined name=RedefineSubclassWithTwoInterfacesTarget, count=1 (avail_mem=1083932K) RedefineClasses-0x4000: calling check_class RedefineClasses-0x4000: klassItable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: LRedefineSubclassWithTwoInterfacesImpl; itable dump -- ( 0) public -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) ( 1) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: _old_methods -- RedefineClasses-0x4000: 0 ( -2) public {old} -- virtual void RedefineSubclassWithTwoInterfacesTarget.<init>() RedefineClasses-0x4000: 1 ( 5) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: _new_methods -- RedefineClasses-0x4000: 0 ( -2) public -- virtual void RedefineSubclassWithTwoInterfacesTarget.<init>() RedefineClasses-0x4000: 1 ( 5) public -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: _matching_(old/new)_methods -- RedefineClasses-0x4000: 0 ( -2) public {old} -- virtual void RedefineSubclassWithTwoInterfacesTarget.<init>() RedefineClasses-0x4000: ( -2) public RedefineClasses-0x4000: 1 ( 5) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: ( 5) public RedefineClasses-0x4000: _deleted_methods -- RedefineClasses-0x4000: _added_methods -- # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (jvmtiRedefineClasses.cpp:3459), pid=3488, tid=9160 # guarantee(false) failed: OLD and/or OBSOLETE method(s) found # # JRE version: Java(TM) SE Runtime Environment (8.0-b75) (build 1.8.0-ea-b75) # Java VM: Java HotSpot(TM) Client VM (25.0-b18-7182152_exp_hsx25_dcubed-product mixed mode windows-x86 ) # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\\work\\shared\\bug_hunt\\jdk8\\exp\\sdk-jli.windows-i586\\JTwork\\java\\lang\\instrument\\RedefineSubclassWithTwoInterfaces\\hs_err_pid3488.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # INFO: <end output.log> FAIL: RedefineSubclassWithTwoInterfacesApp failed. ----------System.err:(0/0)---------- result: Failed. Execution failed: exit code 1 test result: Failed. Execution failed: exit code 1
06-02-2013

Here is what a failing run of RedefineSubclassWithTwoInterfaces.sh looks like: Hello from RedefineSubclassWithTwoInterfacesApp! RedefineSubclassWithTwoInterfacesApp: mesg='intf1<echo: (version-0) <test message #0>> intf2< echo: (version-0) <test message #0>>' before any redefines Reading test class from RedefineSubclassWithTwoInterfacesImpl_1.class RedefineClasses-0x1: loading name=RedefineSubclassWithTwoInterfacesImpl kind=102 (avail_mem=943724K) RedefineClasses-0x1: loaded name=RedefineSubclassWithTwoInterfacesImpl (avail_mem=943708K) RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesImpl RedefineClasses-0x1: redefined name=RedefineSubclassWithTwoInterfacesImpl, count=1 (avail_mem=943668K) RedefineClasses-0x4000: calling check_class RedefineClasses-0x4: vm_op: all=0 prologue=0 doit=0 RedefineClasses-0x4: redefine_single_class: phase1=0 phase2=0 Reading test class from RedefineSubclassWithTwoInterfacesTarget_1.class RedefineClasses-0x1: loading name=RedefineSubclassWithTwoInterfacesTarget kind=102 (avail_mem=943392K) RedefineClasses-0x1: loaded name=RedefineSubclassWithTwoInterfacesTarget (avail_mem=943384K) RedefineClasses: adjust: name=RedefineSubclassWithTwoInterfacesTarget RedefineClasses-0x100000: vtable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x200000: itable method update: echo((Ljava/lang/String;)Ljava/lang/String;) RedefineClasses-0x1: redefined name=RedefineSubclassWithTwoInterfacesTarget, count=1 (avail_mem=943384K) RedefineClasses-0x4000: calling check_class RedefineClasses-0x4000: klassItable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: LRedefineSubclassWithTwoInterfacesImpl; RedefineClasses-0x4000: itable dump -- RedefineClasses-0x4000: ( 0) public -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: ( 1) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: _old_methods -- RedefineClasses-0x4000: 0 ( -2) public {old} -- virtual void RedefineSubclassWithTwoInterfacesTarget.<init>() RedefineClasses-0x4000: 1 ( 5) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: _new_methods -- RedefineClasses-0x4000: 0 ( -2) public -- virtual void RedefineSubclassWithTwoInterfacesTarget.<init>() RedefineClasses-0x4000: 1 ( 5) public -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: _matching_(old/new)_methods -- RedefineClasses-0x4000: 0 ( -2) public {old} -- virtual void RedefineSubclassWithTwoInterfacesTarget.<init>() RedefineClasses-0x4000: ( -2) public RedefineClasses-0x4000: 1 ( 5) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: ( 5) public RedefineClasses-0x4000: _deleted_methods -- RedefineClasses-0x4000: _added_methods -- # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (jvmtiRedefineClasses.cpp:3459), pid=4904, tid=5028 # guarantee(false) failed: OLD and/or OBSOLETE method(s) found # # JRE version: Java(TM) SE Runtime Environment (8.0-b72) (build 1.8.0-ea-b72) # Java VM: Java HotSpot(TM) Client VM (25.0-b18-7182152_exp_hsx25_dcubed-product mixed mode windows-x86 ) # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\\work\\shared\\bug_hunt\\jdk8\\exp\\sdk-jli.windows-i586\\JTwork\\java\\lang\\instrument\\RedefineSubclassWithTwoInterfaces\\hs_err_pid4904.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # FAIL: RedefineSubclassWithTwoInterfacesApp failed. ----------System.err:(0/0)---------- result: Failed. Execution failed: exit code 1 test result: Failed. Execution failed: exit code 1 The key lines in the above output are: RedefineClasses-0x4000: calling check_class RedefineClasses-0x4000: klassItable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: LRedefineSubclassWithTwoInterfacesImpl; RedefineClasses-0x4000: itable dump -- RedefineClasses-0x4000: ( 0) public -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) RedefineClasses-0x4000: ( 1) public {old} {obsolete} -- virtual jobject RedefineSubclassWithTwoInterfacesTarget.echo(jobject) which show the "old" and "obsolete" version of the echo() method in the i-table. And, of course: # Internal Error (jvmtiRedefineClasses.cpp:3459), pid=4904, tid=5028 # guarantee(false) failed: OLD and/or OBSOLETE method(s) found
01-02-2013

Here is what a failing run of RedefineAbstractClass.sh looks like: > VM Started: No frames on the current call stack main[1] Deferring breakpoint shtest:10. It will be set after the class is loaded. main[1] Deferring breakpoint shtest:15. It will be set after the class is loaded. main[1] > This is RedefineAbstractClass Set deferred breakpoint shtest:15MyAbstractClass.checkFunc() called. In doWork() calling checkFunc(): true MyAbstractClass.checkFunc() called. In doWork() calling if1.checkFunc(): true MyAbstractClass.checkFunc() called. In doWork() calling if2.checkFunc(): true Set deferred breakpoint shtest:10 Breakpoint hit: "thread=main", shtest.main(), line=10 bci=20 10 System.out.println("stop here for redefine"); // @1 breakpoint main[1] main[1] stop here for redefine> MyAbstractClass.checkFunc() called. This is call 4 to checkFunc In doWork() calling checkFunc(): true MyAbstractClass.checkFunc() called. This is call 5 to checkFunc In doWork() calling if1.checkFunc(): true MyAbstractClass.checkFunc() called. In doWork() calling if2.checkFunc(): true Breakpoint hit: "thread=main", shtest.main(), line=15 bci=32 15 System.out.println("stop here to check results"); // @2 breakpoint main[1] stop here to check results ----------System.err:(35/1765)---------- ShellScaffold.sh: Version --Sending cmd: stop at shtest:10 --Sending cmd: stop at shtest:15 --Sending cmd: run java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b72) Java HotSpot(TM) Client VM (build 25.0-b18-7182152_exp_hsx25_dcubed-product, mixed mode) --Sending cmd: redefine MyAbstractClass C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/vers2/MyAbstractClass.class --Sending cmd: cont --Sending cmd: quit -rw-rw-rw- 1 dcubed None 1058 Jan 30 21:44 C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/testFailed <cleanup:_begin_failFile_contents> --Fail: main: Required output "This is call 6 to checkFunc" not found in C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/debuggeeOutput.txt C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/debuggeeOutput.txt ---- contents of C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/debuggeeOutput.txt follows ------- This is RedefineAbstractClass MyAbstractClass.checkFunc() called. In doWork() calling checkFunc(): true MyAbstractClass.checkFunc() called. In doWork() calling if1.checkFunc(): true MyAbstractClass.checkFunc() called. In doWork() calling if2.checkFunc(): true stop here for redefine MyAbstractClass.checkFunc() called. This is call 4 to checkFunc In doWork() calling checkFunc(): true MyAbstractClass.checkFunc() called. This is call 5 to checkFunc In doWork() calling if1.checkFunc(): true MyAbstractClass.checkFunc() called. In doWork() calling if2.checkFunc(): true stop here to check results --------------- <cleanup:_end_failFile_contents> result: Failed. Execution failed: exit code 1 test result: Failed. Execution failed: exit code 1 The key line in the above output is: --Fail: main: Required output "This is call 6 to checkFunc" not found in C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/debuggeeOutput.txt C:/work/shared/bug_hunt/jdk8/exp/sdk-jdi.windows-i586/JTwork/classes/com/sun/jdi/aa2856/debuggeeOutput.txt
01-02-2013