File PStack-808293.patch of Package java-27-openjdk

--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
@@ -108,7 +108,8 @@ public void run(PrintStream out, Debugger dbg) {
                if (jthread != null) {
                   jthread.printThreadInfoOn(out);
                }
-               while (f != null) {
+               int maxStack = 256;
+               while (f != null && maxStack-- > 0) {
                   Address senderSP = null;
                   Address senderFP = null;
                   Address senderPC = null;
@@ -192,10 +193,19 @@ public void run(PrintStream out, Debugger dbg) {
                          senderPC = nameInfo.senderPC();
                       }
                   }
+                  Address oldPC = f.pc();
+                  Address oldFP = f.localVariableBase();
                   f = f.sender(th, senderSP, senderFP, senderPC);
+                  if (f != null
+                      && oldPC.equals(f.pc())
+                      && oldFP.equals(f.localVariableBase())) {
+                      // We didn't make any progress
+                      f = null;
+                  }
                }
             } catch (Exception exp) {
-               exp.printStackTrace();
+               // exp.printStackTrace();
+               out.println("bad stack: " + exp);
                // continue, may be we can do a better job for other threads
             }
             if (concurrentLocks) {
openSUSE Build Service is sponsored by