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

SA utilities: "get_thread_regs failed for a lwp" from jstack(1)

XMLWordPrintable

    • b01
    • x86
    • linux

      FULL PRODUCT VERSION :
      stella:~$ /usr/local/jdk1.5.0/bin/java -version
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
      stella:~$


      FULL OS VERSION :
      stella:~$ uname -a
      Linux stella 2.4.27 #1 SMP Tue Sep 7 14:27:55 PDT 2004 i686 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      Running a program (http://www.jessies.org/~enh/software/terminator) that uses File.exists, we had a hang. It turned out that it was checking whether a file on a remote NFS server existed, and that it was hanging there. (Later tests with SIGQUIT proved this.)

      Using jstack, though, we had a problem:

      Error occurred during stack walking:
      sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp


      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Crash an NFS server, or make it otherwise unreachable, and invoke File.exists on a file that's on the NFS server. Then use jps(1) and jstack(1) to try to get a stack trace.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I'd expect to see a stack trace similar to that from SIGQUIT.

      I actually see good stack traces for the non-hung threads, but this for the hung thread:
      Thread 1984: (state = IN_NATIVE)
      Error occurred during stack walking:
      sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:134)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:437)
      at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:48)
      at sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess.getCurrentFrameGuess(LinuxX86JavaThreadPDAccess.java:75)
      at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
      at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
      at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:42)
      at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
      at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
      at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)
      Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(LinuxDebuggerLocal.java:431)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:109)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      here's the whole output:

      Attaching to process ID 1972, please wait...
      Debugger attached successfully.
      Client compiler detected.
      JVM version is 1.5.0-b64
      Thread 1994: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - javax.swing.TimerQueue.run() @bci=14, line=233 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1993: (state = IN_NATIVE)
       - java.io.FileInputStream.readBytes(byte[], int, int) (Interpreted frame)
       - java.io.FileInputStream.read(byte[], int, int) @bci=4, line=194 (Interpreted frame)
       - java.io.BufferedInputStream.read1(byte[], int, int) @bci=39, line=254 (Interpreted frame)
       - java.io.BufferedInputStream.read(byte[], int, int) @bci=49, line=313 (Interpreted frame)
       - terminator.terminal.TerminalControl.run() @bci=14, line=95 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1986: (state = IN_NATIVE)
       - java.lang.UNIXProcess.waitForProcessExit(int) (Interpreted frame)
       - java.lang.UNIXProcess.access$900(java.lang.UNIXProcess, int) @bci=2, line=20 (Interpreted frame)
       - java.lang.UNIXProcess$1$1.run() @bci=165, line=132 (Interpreted frame)


      Thread 1972: (state = BLOCKED)


      Thread 1984: (state = BLOCKED)
       - java.lang.Object.wait(long) (Compiled frame; information may be imprecise)
       - java.lang.Object.wait() @bci=2, line=474 (Compiled frame)
       - java.awt.EventDispatchThread.pumpOneEventForHierarchy(int, java.awt.Component) @bci=9, line=189 (Compiled frame)
       - java.awt.EventDispatchThread.pumpEventsForHierarchy(int, java.awt.Conditional, java.awt.Component) @bci=26, line=163 (Interpreted frame)
       - java.awt.EventDispatchThread.pumpEvents(int, java.awt.Conditional) @bci=4, line=157 (Interpreted frame)
       - java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional) @bci=3, line=149 (Interpreted frame)
       - java.awt.EventDispatchThread.run() @bci=9, line=110 (Interpreted frame)


      Thread 1983: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.Object.wait() @bci=2, line=474 (Interpreted frame)
       - sun.awt.AWTAutoShutdown.run() @bci=32, line=259 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1982: (state = IN_NATIVE)
       - sun.awt.X11.XToolkit.waitForEvents() (Interpreted frame)
       - sun.awt.X11.XToolkit.run(boolean) @bci=64, line=463 (Interpreted frame)
       - sun.awt.X11.XToolkit.run() @bci=5, line=438 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1981: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=116 (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove() @bci=2, line=132 (Interpreted frame)
       - sun.java2d.Disposer.run() @bci=3, line=107 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1977: (state = BLOCKED)


      Thread 1976: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=116 (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove() @bci=2, line=132 (Interpreted frame)
       - java.lang.ref.Finalizer$FinalizerThread.run() @bci=3, line=159 (Interpreted frame)


      Thread 1975: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.Object.wait() @bci=2, line=474 (Interpreted frame)
       - java.lang.ref.Reference$ReferenceHandler.run() @bci=46, line=116 (Interpreted frame)


      johnw@stella:~$ /usr/local/jdk1.5.0/bin/jstack 1972
      Attaching to process ID 1972, please wait...
      Debugger attached successfully.
      Client compiler detected.
      JVM version is 1.5.0-b64
      Thread 1994: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - javax.swing.TimerQueue.run() @bci=14, line=233 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1993: (state = IN_NATIVE)
       - java.io.FileInputStream.readBytes(byte[], int, int) (Interpreted frame)
       - java.io.FileInputStream.read(byte[], int, int) @bci=4, line=194 (Interpreted frame)
       - java.io.BufferedInputStream.read1(byte[], int, int) @bci=39, line=254 (Interpreted frame)
       - java.io.BufferedInputStream.read(byte[], int, int) @bci=49, line=313 (Interpreted frame)
       - terminator.terminal.TerminalControl.run() @bci=14, line=95 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1986: (state = IN_NATIVE)
       - java.lang.UNIXProcess.waitForProcessExit(int) (Interpreted frame)
       - java.lang.UNIXProcess.access$900(java.lang.UNIXProcess, int) @bci=2, line=20 (Interpreted frame)
       - java.lang.UNIXProcess$1$1.run() @bci=165, line=132 (Interpreted frame)


      Thread 1972: (state = BLOCKED)


      Thread 1984: (state = IN_NATIVE)
      Error occurred during stack walking:
      sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:134)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:437)
      at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:48)
      at sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess.getCurrentFrameGuess(LinuxX86JavaThreadPDAccess.java:75)
      at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
      at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
      at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:42)
      at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
      at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
      at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)
      Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(LinuxDebuggerLocal.java:431)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:109)


      Thread 1983: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.Object.wait() @bci=2, line=474 (Interpreted frame)
       - sun.awt.AWTAutoShutdown.run() @bci=32, line=259 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1982: (state = IN_NATIVE)
       - sun.awt.X11.XToolkit.waitForEvents() (Compiled frame; information may be imprecise)
       - sun.awt.X11.XToolkit.run(boolean) @bci=64, line=463 (Compiled frame)
       - sun.awt.X11.XToolkit.run() @bci=5, line=438 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1981: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=116 (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove() @bci=2, line=132 (Interpreted frame)
       - sun.java2d.Disposer.run() @bci=3, line=107 (Interpreted frame)
       - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)


      Thread 1977: (state = BLOCKED)


      Thread 1976: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=116 (Interpreted frame)
       - java.lang.ref.ReferenceQueue.remove() @bci=2, line=132 (Interpreted frame)
       - java.lang.ref.Finalizer$FinalizerThread.run() @bci=3, line=159 (Interpreted frame)


      Thread 1975: (state = BLOCKED)
       - java.lang.Object.wait(long) (Interpreted frame)
       - java.lang.Object.wait() @bci=2, line=474 (Interpreted frame)
       - java.lang.ref.Reference$ReferenceHandler.run() @bci=46, line=116 (Interpreted frame)



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      I've described my example above, and it's totally reproduceable, but you may be able to come up with something more convenient. I'd guess that anything hung in native code will give an equivalent result (though I haven't tried anything else).
      ---------- END SOURCE ----------

            swamyv Swamy Venkataramanappa
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: