Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8031968

Mac OS X: VM starts the agent by calling both Agent_OnAttach and Agent_OnAttach_L functions if its agent library is dynamically linked.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u20
    • 8, 9
    • hotspot
    • name -v
      Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64

    • b04
    • x86_64
    • os_x

        JDK 8 JVMTI spec. 1.2.3 (http://download.java.net/jdk8/docs/platform/jvmti/jvmti.html) states:
        Agent Start-Up (Live phase)
        ...
        If an agent is started during the live phase then its agent library must export a start-up function with the following prototype:
        JNIEXPORT jint JNICALL
        Agent_OnAttach(JavaVM* vm, char *options, void *reserved)
        Or for a statically linked agent named 'L':
        JNIEXPORT jint JNICALL
        Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)
        The VM will start the agent by calling this function.
        ....
        According to this assertion the VM will never call Agent_OnAttach_L if the function exists and the agent library is dynamically linked.

        This issue causes a failure of 366 JCK 8 tests (JCK-7301996)
        Error log is:
        --''--
        Successfully attached to JVM with id: 15050
        Native agent successfully loaded: name=jckjvmti opts=ascl00101
        Agent_OnAttach_jckjvmti entry was unexpectedly invoked
        --''--
        Source file that returns "failed" status is JCK-runtime-8/src/javasoft/sqe/jck/lib/jvmti/Agent.java
        Appropriate code snippet is:

        if (isOnAttachMode) {
                    if (isJckjvmtiStaticallyLinked) {
                        if (!isAgentOnAttachForJckJvmtiInvoked()) {
                            out.println("Agent_OnAttach_jckjvmti entry was not invoked as expected\n");
                            status = STAT_FAILED;
                            return false;
                        }
                        if (isAgentOnAttachInvoked()) {
                            out.println("Agent_OnAttach entry was unexpectedly invoked");
                            status = STAT_FAILED;
                            return false;
                        }
                    } else {
                        if (!isAgentOnAttachInvoked()) {
                            out.println("Agent_OnAttach entry was not invoked as expected");
                            status = STAT_FAILED;
                            return false;
                        }
                        if (isAgentOnAttachForJckJvmtiInvoked()) {
                            out.println("Agent_OnAttach_jckjvmti entry was unexpectedly invoked");
                            status = STAT_FAILED;
                            return false;
                        }
                    }

                    if (isAgentOnLoadInvoked()) {
                        out.println("Agent_OnLoad entry was unexpectedly invoked");
                        status = STAT_FAILED;
                        return false;
                    }
                    if (isAgentOnLoadForJckJvmtiInvoked()) {
                        out.println("Agent_OnLoad_jckjvmti entry was unexpectedly invoked\n");
                        status = STAT_FAILED;
                        return false;
                    }
                }

        Note: This issue only happens on Mac OS X (10.9.1)






          


          1. run.sh
            0.6 kB
            Leonid Kuskov

              sla Staffan Larsen (Inactive)
              lkuskov Leonid Kuskov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: