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

JVM_DumpAllStacks() 'd have a feature to detect deadlock

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P3
    • None
    • 6
    • hotspot
    • generic
    • generic

    Description

      The dead-lock detection feature should be added to JVM_DumpAllStacks().

      When there is dead-lock in Java, the status of dead-lock
      is reported(output) in Full thread Dump with SIGQUIT.

      This process seems to be implemented at the following (*)
      extracted from ./share/vm/runtime/os.cpp.
      (This example is based on 1.4.2_04)

      ----->
      ......
          switch (sig) {
            case SIGBREAK: {
              // Print stack traces
              VM_PrintThreads op;
              VMThread::execute(&op);
              VM_FindDeadlocks op1; (*)
              VMThread::execute(&op1); (*)
              if (PrintClassHistogram) {
                VM_GC_HeapInspection op1;
                VMThread::execute(&op1);
              }
              jvmpi::post_dump_event();
              break;
            }
      ....
      <------

      On the other hand, there seems the similar feature to output
      Full Thread Dump in JavaVM function, JVM_DumpAllStacks().
      However, this function does not seem to work, which is,
      not detect dead-lock status.
      (The following src is extracted from . src/share/vm/prims/jvm.cpp.)

      --->
      ....
      JVM_ENTRY(void, JVM_DumpAllStacks(JNIEnv* env, jclass))
        JVMWrapper("JVM_DumpAllStacks");
        VM_PrintThreads op;
        VMThread::execute(&op);
        jvmpi::post_dump_event();
      JVM_END
      ...
      <-----

      JVM_DumpAllStacks() seems called by Plug-in.
      If true, when a dead lock occurs during plug-in,
      dead-lock detection feature will not work correctly.

      SUGGESTION:
        How about to apply the following modification to jvm.cpp
        as follows ?

      ----->
      *** jvm.cpp.orig Thu Jun 17 19:36:45 2004
      --- jvm.cpp Thu Jun 17 19:38:49 2004
      ***************
      *** 2144,2149 ****
      --- 2144,2151 ----
          JVMWrapper("JVM_DumpAllStacks");
          VM_PrintThreads op;
          VMThread::execute(&op);
      + VM_FindDeadlocks op1;
      + VMThread::execute(&op1);
          jvmpi::post_dump_event();
        JVM_END
      <----

      ######################################################################

      Attachments

        Issue Links

          Activity

            People

              mchung Mandy Chung
              tbaba Tadayuki Baba (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: