harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Popov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3304) [jdktools][jpda] JDWP tests for method invocation fails with error <110(OUT_OF_MEMORY)>
Date Fri, 23 Mar 2007 13:49:32 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483601
] 

Ivan Popov commented on HARMONY-3304:
-------------------------------------

The root problem is that JNI function NewGlobalRef() returns null for exception object. According
to JNI spec this means "the system runs out of memory" and JDWP agent returns appropriate
error code.

Here is the corresponding fragment of JDWP agent code (ObjectReference.cpp:861):

    m_returnException = jni->ExceptionOccurred();
    if (m_returnException != 0) {
        m_returnException =
            static_cast<jthrowable>(jni->NewGlobalRef(m_returnException));
        if (m_returnException == 0) {
            m_returnError = JDWP_ERROR_OUT_OF_MEMORY;
        }
    }
    jni->ExceptionClear();

I added printing exception object before and after calling NewGlobalRef():

    m_returnException = jni->ExceptionOccurred();
    if (m_returnException != 0) {
        JDWP_INFO("*** exception before NewGlobalRef(): " << (void*)m_returnException);
        m_returnException =
            static_cast<jthrowable>(jni->NewGlobalRef(m_returnException));
        JDWP_INFO("*** exception after NewGlobalRef(): " << (void*)m_returnException);
        if (m_returnException == 0) {
            m_returnError = JDWP_ERROR_OUT_OF_MEMORY;
        }
    }
    jni->ExceptionClear();

and got the following output:

  Send ObjectReference.InvokeMethod with exception...
  STDOUT>  INFO: [ObjectReference.cpp:865] *** exception before NewGlobalRef(): 02A50A98
  STDOUT>  INFO: [ObjectReference.cpp:868] *** exception after NewGlobalRef(): 00000000
  # ERROR: ObjectReference::InvokeMethod command, Error Code:<110(OUT_OF_MEMORY)>

Placing ExceptionClear() before the call to NewGlobalRef() solves this problem:

  Send ObjectReference.InvokeMethod with exception...
  STDOUT>  INFO: [ObjectReference.cpp:866] *** exception before NewGlobalRef(): 02A51360
  STDOUT>  INFO: [ObjectReference.cpp:869] *** exception after NewGlobalRef(): 02A4F7D0
   ObjectReference.InvokeMethod: returnValue.getIntValue()=0
   ObjectReference.InvokeMethod: exception.tag=76 exception.objectID=1164

However, with RI VM this works in both cases. I think NewGlobalRef() should be fixed to don't
return NULL for pending exception.


> [jdktools][jpda] JDWP tests for method invocation fails with error <110(OUT_OF_MEMORY)>
> ---------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3304
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3304
>             Project: Harmony
>          Issue Type: Bug
>          Components: JDK
>         Environment: Windows/ia32, Linux/ia32, Harmony-jdk-r514598
>            Reporter: Ivan Popov
>
> The following JDWP unit tests for method invocation:
>   org.apache.harmony.jpda.tests.jdwp.ClassType.InvokeMethodTest
>   org.apache.harmony.jpda.tests.jdwp.ClassType.NewInstanceTest
>   org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodTest
> fails in execution of the corresponding JDWP command with the same diagnostics:
> junit.framework.AssertionFailedError: ObjectReference::InvokeMethod command, Error Code:<110(OUT_OF_MEMORY)>
at org.apache.harmony.jpda.tests.jdwp.share.JDWPTestCase.printErrorAndFail(JDWPTestCase.java:729)
at org.apache.harmony.jpda.tests.jdwp.share.JDWPTestCase.checkReplyPacket(JDWPTestCase.java:638)
at org.apache.harmony.jpda.tests.jdwp.share.JDWPTestCase.checkReplyPacket(JDWPTestCase.java)
at org.apache.harmony.jpda.tests.jdwp.share.JDWPTestCase.checkReplyPacket(JDWPTestCase.java:539)
at org.apache.harmony.jpda.tests.jdwp.share.JDWPTestCase.checkReplyPacket(JDWPTestCase.java)
at org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodTest.testInvokeMethod001(InvokeMethodTest.java:247)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> To reproduce this failure:
> 1. create Harmony JDK with federated build:
>     svn checkout https://svn.apache.org/repos/asf/harmony/enhanced/trunk
>     cd trunk
>     ant
> 2. goto jdktools directory, add junit to classpath, and run particular test:
>     cd working_jdktools
>     export CLASSPATH=<...>/trunk/common_resources/depends/jars/junit_3.8.2/junit.jar
>     ant test -Dbuild.module=jpda -Dtest.case=org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodTest
>  
> 3. see results in <...>/trunk/working_jdktools/build/test_report/html/index.html
> It is possible also to run test directly from command line:
>    cd working_jdktools
>    deploy/jdk/bin/java -classpath ../common_resources/depends/jars/junit_3.8.2/junit.jar:build/tests/classes
\
>    org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodTest 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message