1 Reply Latest reply on Nov 29, 2007 1:42 AM by 843810

    Unable to stop threads from jvmti

      I have an agent that is attempting to stop a thread started in java code that is being called through JNI. What are the reasons a thread would fail when calling (*jvmti)->StopThread? This is what I am doing and further below is the dump.
      currentThread = threadPtr;
      err = (*jvmti)->GetThreadInfo(jvmti, currentThread, &threadInfoPtr);
      err = (*jvmti)->GetThreadState(jvmti, currentThread, &threadStatePtr);
      printf("Thread Name %s +++++++++++++", threadInfoPtr.name);          
      if ( i == 14 ) {
           printf("I am now going to kill %s\n", threadInfoPtr.name);
           err = (*jvmti)->StopThread(jvmti, threadPtr[i], exception);
           check_jvmti_error(jvmti, err, "Trying to stop a thread");
      # An unexpected error has been detected by Java Runtime Environment:
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6da0b364, pid=2532, tid=3024
      # Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode)
      # Problematic frame:
      # V [jvm.dll+0x19b364]
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp

      --------------- T H R E A D ---------------

      Current thread (0x0afe0c00): VMThread [id=3024]

      siginfo: ExceptionCode=0xc0000005, reading address 0x00000d60

      EAX=0x06ef39c8, EBX=0x0afe0f00, ECX=0x0be82400, EDX=0x6da5f154
      ESP=0x0b16fb78, EBP=0x0afe0f08, ESI=0x0be82400, EDI=0x00000d5c
      EIP=0x6da0b364, EFLAGS=0x00010246

      Top of Stack: (sp=0x0b16fb78)
      0x0b16fb78: 0be96128 0be96128 0afe0f00 00000000
      0x0b16fb88: 00000000 00000000 00000000 6da44578
      0x0b16fb98: 0b16fb64 00000000 00000100 0b16fc30
      0x0b16fba8: 00000011 10001896 00000104 010345fa
      0x0b16fbb8: 01034610 01034548 0103464b 00000110
      0x0b16fbc8: 0b16fbc4 00000001 00000000 00000114
      0x0b16fbd8: 00000000 00000000 6da5c554 0b16fbb0
      0x0b16fbe8: 01034646 00000000 00000000 7ffdc000

      Instructions: (pc=0x6da0b364)
      0x6da0b354: 2b 01 00 00 8b bc 24 e8 00 00 00 a1 04 e9 a8 6d
      0x6da0b364: 8b 4f 04 8b 50 10 8b 1c 0a 83 c1 08 3b d8 74 0f

      Stack: [0x0b070000,0x0b170000), sp=0x0b16fb78, free space=1022k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [jvm.dll+0x19b364]

      VM_Operation (0x0be96128): thread stop, mode: async safepoint, requested by thread 0x0b013000

      --------------- P R O C E S S ---------------

      Java Threads: ( => current thread )
      0x0be83800 JavaThread "GC Daemon" daemon [_thread_blocked, id=2768]
      0x0be8a000 JavaThread "RMI Reaper" [_thread_blocked, id=3548]
      0x0be88400 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=2788]
      0x0be82400 JavaThread "Timer-1" daemon [_thread_blocked, id=4084]
      0x0be7e400 JavaThread "Timer-0" daemon [_thread_blocked, id=3156]
      0x0b02a000 JavaThread "Thread-2" [_thread_in_native, id=3420]
      0x0b01e000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2980]
      0x0b01d400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3468]
      0x0b013000 JavaThread "Thread-0" daemon [_thread_blocked, id=3324]
      0x0aff8000 JavaThread "Attach Listener" daemon [_thread_blocked, id=2372]
      0x0afe8400 JavaThread "Finalizer" daemon [_thread_blocked, id=1104]
      0x0afe4000 JavaThread "Reference Handler" daemon [_thread_blocked, id=2168]
      0x00e07c00 JavaThread "main" [_thread_in_native, id=2460]

      Other Threads:
      =>0x0afe0c00 VMThread [id=3024]
      0x0b020c00 WatcherThread [id=2364]

      VM state:at safepoint (normal execution)

      VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
      [0x00e06798/0x00000108] Threads_lock - owner thread: 0x0afe0c00

      def new generation total 1664K, used 1504K [0x02ed0000, 0x03090000, 0x033b0000)
      eden space 1536K, 89% used [0x02ed0000, 0x03028370, 0x03050000)
      from space 128K, 100% used [0x03070000, 0x03090000, 0x03090000)
      to space 128K, 0% used [0x03050000, 0x03050000, 0x03070000)
      tenured generation total 21184K, used 16007K [0x033b0000, 0x04860000, 0x06ed0000)
      the space 21184K, 75% used [0x033b0000, 0x04351d08, 0x04351e00, 0x04860000)
      compacting perm gen total 16896K, used 16805K [0x06ed0000, 0x07f50000, 0x0aed0000)
      the space 16896K, 99% used [0x06ed0000, 0x07f394f0, 0x07f39600, 0x07f50000)
      No shared spaces configured.

      --------------- S Y S T E M ---------------

      OS: Windows XP Build 2600 Service Pack 2

      CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht

      Memory: 4k page, physical 2086980k(1336036k free), swap 4194303k(4194303k free)

      vm_info: Java HotSpot(TM) Client VM (1.6.0_01-b06) for windows-x86, built on Mar 14 2007 00:24:02 by "java_re" with unknown MS VC++:1310