Harmony
  1. Harmony
  2. HARMONY-2228

[drlvm] java.awt.AccessibleAWTCheckboxMenuItemTest crashes on DRLVM interpreter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DRLVM
    • Labels:
      None
    • Environment:
      SUSE9
      DRLVM release build interpreter mode
    • Patch Info:
      Patch Available

      Description

      Stably observed crash, steps to reproduce:

      edit harmonyvm.properties of DRLVM, add '-Xint' line;
      ant -Dtest.jre.home=$drlvm/build/lnx_ia32_gcc_release/deploy/jre -Dbuild.module=awt test

      [junit] SIGSEGV in VM code.
      [junit] ****** STACK DUMP: ************
      [junit] java/awt/GraphicsEnvironment.getLocalGraphicsEnvironment()Ljava/awt/GraphicsEnvironment; (GraphicsEnvironment.java:40)
      [junit] java/awt/GraphicsEnvironment.isHeadless()Z (GraphicsEnvironment.java:-1)
      [junit] java/awt/Toolkit.checkHeadless()V (Toolkit.java:-1)
      [junit] java/awt/MenuComponent.<init>()V (MenuComponent.java:-1)
      [junit] java/awt/MenuItem.<init>(Ljava/lang/String;Ljava/awt/MenuShortcut;)V (MenuItem.java:-1)
      [junit] java/awt/MenuItem.<init>()V (MenuItem.java:-1)
      [junit] java/awt/CheckboxMenuItem.<init>()V (CheckboxMenuItem.java:-1)
      [junit] java/awt/AccessibleAWTCheckboxMenuItemTest.setUp()V (AccessibleAWTCheckboxMenuItemTest.java:-1)
      [junit] junit/framework/TestCase.runBare()V (TestCase.java:-1)
      [junit] junit/framework/TestResult$1.protect()V (TestResult.java:-1)
      [junit] junit/framework/TestResult.runProtected(Ljunit/framework/Test;Ljunit/framework/Protectable;)V (TestResult.java:-1)
      [junit] junit/framework/TestResult.run(Ljunit/framework/TestCase;)V (TestResult.java:-1)
      [junit] junit/framework/TestCase.run(Ljunit/framework/TestResult;)V (TestCase.java:-1)
      [junit] junit/framework/TestSuite.runTest(Ljunit/framework/Test;Ljunit/framework/TestResult;)V (TestSuite.java:-1)
      [junit] junit/framework/TestSuite.run(Ljunit/framework/TestResult;)V (TestSuite.java:-1)
      [junit] org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.run()V (JUnitTestRunner.java:-1)
      [junit] org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.launch(Lorg/apache/tools/ant/taskdefs/optional/junit/JUnitTest;ZZZZLjava/util/Properties;)I (JUnitTestRunner.java:-1)
      [junit] org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.main([Ljava/lang/String;)V (JUnitTestRunner.java:-1)

      1. h2228.fix
        0.7 kB
        Ivan Volosyuk

        Activity

        Hide
        Alexey Varlamov added a comment -

        Applied at r482151.
        Thanks!

        Show
        Alexey Varlamov added a comment - Applied at r482151. Thanks!
        Hide
        Ivan Volosyuk added a comment -

        Fix attached.

        Problem was that fake method is classloader created for abstract methods had unitinialized _arguments_size field.

        Show
        Ivan Volosyuk added a comment - Fix attached. Problem was that fake method is classloader created for abstract methods had unitinialized _arguments_size field.
        Hide
        Ivan Volosyuk added a comment -

        The returned object is correct.

        Problem in classloader in function Method::get_num_arg_bytes()
        It returns 0 for method with descriptor: (Lorg/apache/harmony/awt/wtk/WindowFactory;)Ljava/awt/GraphicsEnvironment;
        This leads to crash.

        Show
        Ivan Volosyuk added a comment - The returned object is correct. Problem in classloader in function Method::get_num_arg_bytes() It returns 0 for method with descriptor: (Lorg/apache/harmony/awt/wtk/WindowFactory;)Ljava/awt/GraphicsEnvironment; This leads to crash.
        Hide
        Ivan Volosyuk added a comment -

        Failed object is a this pointer used in call to <obj>.createGraphicsEnvironment(...) function.

        It appeared from:
        CommonGraphics2DFactory g2df = (CommonGraphics2DFactory) Toolkit.getDefaultToolkit().getGraphicsFactory();

        Show
        Ivan Volosyuk added a comment - Failed object is a this pointer used in call to <obj>.createGraphicsEnvironment(...) function. It appeared from: CommonGraphics2DFactory g2df = (CommonGraphics2DFactory) Toolkit.getDefaultToolkit().getGraphicsFactory();
        Hide
        Ivan Volosyuk added a comment -

        Debug version of the DRLVM fails on validity check of heap object referenced:
        ASSERT_OBJECT(obj);
        at interpreter.cpp:3437 in function interpreterInvokeVirtual().

        When forcing heap size to be 64mb no garbage collection appears till that point and still failure exists.

        Wrong object reference looks like:

        (gdb) p obj
        $1 = (ManagedObject *) 0xbfff0303

        The pointer is obviously incorrect: wrong alignment, out of java heap range.

        (gdb) i r esp
        esp 0xbfffa5d4 0xbfffa5d4

        The object pointer points into garbage area over the top of current thread.

        The problem looks like a dangling pointer.

        Show
        Ivan Volosyuk added a comment - Debug version of the DRLVM fails on validity check of heap object referenced: ASSERT_OBJECT(obj); at interpreter.cpp:3437 in function interpreterInvokeVirtual(). When forcing heap size to be 64mb no garbage collection appears till that point and still failure exists. Wrong object reference looks like: (gdb) p obj $1 = (ManagedObject *) 0xbfff0303 The pointer is obviously incorrect: wrong alignment, out of java heap range. (gdb) i r esp esp 0xbfffa5d4 0xbfffa5d4 The object pointer points into garbage area over the top of current thread. The problem looks like a dangling pointer.
        Hide
        Ivan Volosyuk added a comment -

        Looking into the bug.

        Show
        Ivan Volosyuk added a comment - Looking into the bug.
        Hide
        Alexey Petrenko added a comment -

        Alexey, please check this issue

        Show
        Alexey Petrenko added a comment - Alexey, please check this issue
        Hide
        Alexey Petrenko added a comment -

        The investigation shows that the java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment breaks in the following line of code:
        ContextStorage.setGraphicsEnvironment(g2df.createGraphicsEnvironment(ContextStorage.getWindowFactory())

        Precisely it returns OK from ContextStorage.getWindowFactory call but never enters g2df.createGraphicsEnvironment method.

        Looks like DRLVM bug for me.

        Show
        Alexey Petrenko added a comment - The investigation shows that the java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment breaks in the following line of code: ContextStorage.setGraphicsEnvironment(g2df.createGraphicsEnvironment(ContextStorage.getWindowFactory()) Precisely it returns OK from ContextStorage.getWindowFactory call but never enters g2df.createGraphicsEnvironment method. Looks like DRLVM bug for me.
        Hide
        Alexey Varlamov added a comment -

        Anyway, your stack looks like exact 1:1 mapping to native interpreter frames - so you should be able obtain the java stack easily in gdb. Well, if you manage to reproduce it from gdb

        Show
        Alexey Varlamov added a comment - Anyway, your stack looks like exact 1:1 mapping to native interpreter frames - so you should be able obtain the java stack easily in gdb. Well, if you manage to reproduce it from gdb
        Hide
        Alexey Varlamov added a comment -

        Alexey, I'm terribly sorry - I meant HARMONY-1653 actually. It adds printing java stack on signal in interpreted mode; your symptoms looks slightly different but the idea is the same...

        Show
        Alexey Varlamov added a comment - Alexey, I'm terribly sorry - I meant HARMONY-1653 actually. It adds printing java stack on signal in interpreted mode; your symptoms looks slightly different but the idea is the same...
        Hide
        Alexey Petrenko added a comment -

        Alexey,

        you patch does not change the situation since your patch for jitrino but the testcase is for interpreter...

        Show
        Alexey Petrenko added a comment - Alexey, you patch does not change the situation since your patch for jitrino but the testcase is for interpreter...
        Hide
        Alexey Varlamov added a comment -

        Please try with HARMONY-1912 patch - I should finally commit it someday

        Show
        Alexey Varlamov added a comment - Please try with HARMONY-1912 patch - I should finally commit it someday
        Hide
        Alexey Petrenko added a comment -

        It fails with absolutely different message on my SUSE9:
        [junit] Running org.apache.harmony.awt.gl.font.LineMetricsImplRTest
        [junit] SIGSEGV in VM code.
        [junit] Stack trace:
        [junit] 1: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 2: .L2231 (??:-1)
        [junit] 3: interpreterInvokeStatic(StackFrame&, Method*) (??:-1)
        [junit] 4: .L2167 (??:-1)
        [junit] 5: interpreterInvokeStatic(StackFrame&, Method*) (??:-1)
        [junit] 6: .L2167 (??:-1)
        [junit] 7: interpreterInvokeStatic(StackFrame&, Method*) (??:-1)
        [junit] 8: .L2167 (??:-1)
        [junit] 9: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1)
        [junit] 10: .L2225 (??:-1)
        [junit] 11: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1)
        [junit] 12: .L2225 (??:-1)
        [junit] 13: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1)
        [junit] 14: .L2225 (??:-1)
        [junit] 15: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1)
        [junit] 16: .L2225 (??:-1)
        [junit] 17: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 18: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 19: .L2231 (??:-1)
        [junit] 20: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 21: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 22: .L2231 (??:-1)
        [junit] 23: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 24: interpreterInvokeInterface(StackFrame&, Method*) (??:-1)
        [junit] 25: .L2237 (??:-1)
        [junit] 26: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 27: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 28: .L2231 (??:-1)
        [junit] 29: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 30: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 31: .L2231 (??:-1)
        [junit] 32: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 33: interpreterInvokeInterface(StackFrame&, Method*) (??:-1)
        [junit] 34: .L2237 (??:-1)
        [junit] 35: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 36: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 37: .L2231 (??:-1)
        [junit] 38: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 39: interpreterInvokeInterface(StackFrame&, Method*) (??:-1)
        [junit] 40: .L2237 (??:-1)
        [junit] 41: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1)
        [junit] 42: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1)
        [junit] 43: .L2231 (??:-1)
        [junit] 44: interpreterInvokeStatic(StackFrame&, Method*) (??:-1)
        [junit] 45: .L2167 (??:-1)
        [junit] 46: .L2746 (??:-1)
        [junit] 47: JIT_execute_method (??:-1)
        [junit] 48: DrlEMImpl::executeMethod(_jmethodID*, jvalue*, jvalue*) (??:-1)
        [junit] 49: ExecuteMethod (??:-1)
        [junit] 50: vm_execute_java_method_array(_jmethodID*, jvalue*, jvalue*) (??:-1)
        [junit] 51: call_static_method_no_ref_result(JNIEnv_External*, _jobject*, _jmethodID*, jvalue*, jvalue*) (??:-1)
        [junit] 52: CallStaticVoidMethodV(JNIEnv_External*, _jobject*, _jmethodID*, char*) (??:-1)
        [junit] 53: CallStaticVoidMethod(JNIEnv_External*, _jobject*, _jmethodID*, ...) (??:-1)
        [junit] 54: ?? (??:-1)
        [junit] 55: ?? (??:-1)
        [junit] 56: ?? (??:-1)
        [junit] 57: ?? (??:-1)
        [junit] 58: hysig_protect (??:-1)
        [junit] 59: ?? (??:-1)
        [junit] 60: __libc_start_main (??:-1)
        [junit] 61: ?? (??:-1)
        [junit] <end of stack trace>
        [junit] Tests FAILED

        Show
        Alexey Petrenko added a comment - It fails with absolutely different message on my SUSE9: [junit] Running org.apache.harmony.awt.gl.font.LineMetricsImplRTest [junit] SIGSEGV in VM code. [junit] Stack trace: [junit] 1: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 2: .L2231 (??:-1) [junit] 3: interpreterInvokeStatic(StackFrame&, Method*) (??:-1) [junit] 4: .L2167 (??:-1) [junit] 5: interpreterInvokeStatic(StackFrame&, Method*) (??:-1) [junit] 6: .L2167 (??:-1) [junit] 7: interpreterInvokeStatic(StackFrame&, Method*) (??:-1) [junit] 8: .L2167 (??:-1) [junit] 9: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1) [junit] 10: .L2225 (??:-1) [junit] 11: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1) [junit] 12: .L2225 (??:-1) [junit] 13: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1) [junit] 14: .L2225 (??:-1) [junit] 15: interpreterInvokeSpecial(StackFrame&, Method*) (??:-1) [junit] 16: .L2225 (??:-1) [junit] 17: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 18: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 19: .L2231 (??:-1) [junit] 20: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 21: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 22: .L2231 (??:-1) [junit] 23: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 24: interpreterInvokeInterface(StackFrame&, Method*) (??:-1) [junit] 25: .L2237 (??:-1) [junit] 26: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 27: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 28: .L2231 (??:-1) [junit] 29: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 30: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 31: .L2231 (??:-1) [junit] 32: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 33: interpreterInvokeInterface(StackFrame&, Method*) (??:-1) [junit] 34: .L2237 (??:-1) [junit] 35: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 36: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 37: .L2231 (??:-1) [junit] 38: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 39: interpreterInvokeInterface(StackFrame&, Method*) (??:-1) [junit] 40: .L2237 (??:-1) [junit] 41: interpreterInvoke(StackFrame&, Method*, int, ManagedObject*, bool) (??:-1) [junit] 42: interpreterInvokeVirtual(StackFrame&, Method*) (??:-1) [junit] 43: .L2231 (??:-1) [junit] 44: interpreterInvokeStatic(StackFrame&, Method*) (??:-1) [junit] 45: .L2167 (??:-1) [junit] 46: .L2746 (??:-1) [junit] 47: JIT_execute_method (??:-1) [junit] 48: DrlEMImpl::executeMethod(_jmethodID*, jvalue*, jvalue*) (??:-1) [junit] 49: ExecuteMethod (??:-1) [junit] 50: vm_execute_java_method_array(_jmethodID*, jvalue*, jvalue*) (??:-1) [junit] 51: call_static_method_no_ref_result(JNIEnv_External*, _jobject*, _jmethodID*, jvalue*, jvalue*) (??:-1) [junit] 52: CallStaticVoidMethodV(JNIEnv_External*, _jobject*, _jmethodID*, char*) (??:-1) [junit] 53: CallStaticVoidMethod(JNIEnv_External*, _jobject*, _jmethodID*, ...) (??:-1) [junit] 54: ?? (??:-1) [junit] 55: ?? (??:-1) [junit] 56: ?? (??:-1) [junit] 57: ?? (??:-1) [junit] 58: hysig_protect (??:-1) [junit] 59: ?? (??:-1) [junit] 60: __libc_start_main (??:-1) [junit] 61: ?? (??:-1) [junit] <end of stack trace> [junit] Tests FAILED
        Show
        Alexei Fedotov added a comment - See http://wiki.apache.org/harmony/Unit_Tests_Pass_on_DRLVM

          People

          • Assignee:
            Alexey Varlamov
            Reporter:
            Alexey Varlamov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development