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

JVMTI GC events don't allow to call raw monitor/memory management

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: egR10015 Date: 09/11/2003


      --------------------------------------
       Test : nsk/jvmti/GarbageCollectionStart/gcstart002
                       : nsk/jvmti/GarbageCollectionFinish/gcfinish001
       TestBase : testbase_vm
       VM : all
       Mode : all
       Platform : generic
       OS : generic
       JDK : 1.5.0-b18
      --------------------------------------

      The JVMTI events GarbageCollectionStart, GarbageCollectionFinish
      do not allow to call the raw monitor functions and memory management
      functions. It contradicts the spec saying:

      | This event is sent while the world is still stopped, thus the event
      | handler should not use JNI functions or JVMTI functions (except the
      | raw monitor functions, Allocate or Deallocate).


      The mentioned tests call the following functions

      CreateRawMonitor()
      RawMonitorEnter()
      RawMonitorExit()
      DestroyRawMonitor()
      Allocate()
      Deallocate()

      during processing an appropriate GC event, but all the functions fail
      with the error JVMTI_ERROR_UNATTACHED_THREAD.

      To reproduce the bug run

      sh do_gcstart.sh $JAVA_HOME for the test 'gcstart002'

      or

      sh do_gcfinish.sh $JAVA_HOME for the test 'gcfinish001'

      in

      /net/jano.sfbay/export/disk20/GammaBase/Bugs/<this bug number>

      where JAVA_HOME should point to jdk1.5

      ----------------- output on Solsparc with HS 1.5-b18: -------------------
      $ sh do_gcstart.sh ~/hotspot/jdk1.5/solsparc
      gcstart002.c:
      share/JVMTITools.c:
      share/agent_tools.c:
      share/jni_tools.c:
      share/jvmti_tools.c:
      share/native_thread.c:
      share/nsk_tools.c:
      Compiling test classes...
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b18)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b18, mixed mode)
      Executing the test ...
      - gcstart002.c, 159: setting event callbacks ...
      - gcstart002.c, 167: setting event callbacks done
      enabling JVMTI events ...
      - gcstart002.c, 174: enabling the events done

      - gcstart002.c, 114: >>>> GarbageCollectionStart event #1 received
      - gcstart002.c, 34: GarbageCollectionStart: creating a raw monitor ...
      # ERROR: gcstart002.c, 36: NSK_CPP_STUB3(CreateRawMonitor, jvmti_env, "_lock",
      &_lock)
      # jvmti error: code=115, name=JVMTI_ERROR_UNATTACHED_THREAD
      # ERROR: gcstart002.c, 39: TEST FAILED: GarbageCollectionStart: unable to create
      a raw monitor

      - gcstart002.c, 84: GarbageCollectionStart: allocating memory ...
      # ERROR: gcstart002.c, 86: NSK_CPP_STUB3(Allocate, jvmti_env, MEM_SIZE, &mem)
      # jvmti error: code=115, name=JVMTI_ERROR_UNATTACHED_THREAD
      # ERROR: gcstart002.c, 89: TEST FAILED: GarbageCollectionStart: unable to
      allocate memory

      - gcstart002.c, 120: <<<<

      ...

      - gcstart002.c, 114: >>>> GarbageCollectionStart event #97 received
      - gcstart002.c, 34: GarbageCollectionStart: creating a raw monitor ...
      # ERROR: gcstart002.c, 36: NSK_CPP_STUB3(CreateRawMonitor, jvmti_env, "_lock",
      &_lock)
      # jvmti error: code=115, name=JVMTI_ERROR_UNATTACHED_THREAD
      # ERROR: gcstart002.c, 39: TEST FAILED: GarbageCollectionStart: unable to create
      a raw monitor

      - gcstart002.c, 84: GarbageCollectionStart: allocating memory ...
      # ERROR: gcstart002.c, 86: NSK_CPP_STUB3(Allocate, jvmti_env, MEM_SIZE, &mem)
      # jvmti error: code=115, name=JVMTI_ERROR_UNATTACHED_THREAD
      # ERROR: gcstart002.c, 89: TEST FAILED: GarbageCollectionStart: unable to
      allocate memory

      - gcstart002.c, 120: <<<<

      - gcstart002.c, 125: VMDeath event received
      exit code = 97
      -------------------------------------------------------------------------

      The tests will be available in release 23 of the testbase_vm.
      ======================================================================

      Name: egR10015 Date: 09/30/2003


      The same issue concerns the JVMTI event ObjectFree. In particular, the
      function GetPhase() returns JVMTI_ERROR_UNATTACHED_THREAD during callback.

      This bug affects the following NSK test:

      nsk/jvmti/ObjectFree/objfree002

      which will be available in release 23 of the testbase_vm.

      Here is fragment of test log:
      ---------------------------------------------------------------
      - objfree002.c, 33: >>>> ObjectFree event received
      # ERROR: objfree002.c, 37: NSK_CPP_STUB2(GetPhase, jvmti_env, &phase)
      # jvmti error: code=115, name=JVMTI_ERROR_UNATTACHED_THREAD
      # ERROR: objfree002.c, 39: TEST FAILED: unable to obtain phase of the VM execution
      - objfree002.c, 58: CHECK PASSED: ObjectFree event #1 received for the object previously tagged with 8
      - objfree002.c, 60: <<<<
      ---------------------------------------------------------------

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

      Name: egR10015 Date: 10/22/2003


      The bug affects also the following NSK test:

      nsk/jvmti/ObjectFree/objfree001

      which fixed version will be available in release 24 of the testbase_vm.

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alanb Alan Bateman
                Reporter:
                eugsunw Eug Eug (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: