< prev index next >

test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java

Print this page
rev 52057 : 8211931: [ppc][testbug] runtime/jni/terminatedThread/TestTerminatedThread.java fails as threads don't terminate immediately

@@ -83,25 +83,33 @@
         if (mbean.isThreadCpuTimeSupported() &&
             mbean.isThreadCpuTimeEnabled() ) {
             System.out.println("Calling getThreadCpuTime ...");
             long t1 = mbean.getThreadCpuTime(t.getId());
             if (t1 != -1) {
-                throw new RuntimeException("Invalid ThreadCpuTime returned = " +
-                                           t1 + " expected = -1");
-            }
+                // At least on PPC, we know threads can still be around a short
+                // instant. In some stress scenarios we seem to grab times of
+                // new threads started with the same thread id. In these cases
+                // we get here.
+                System.out.println("Unexpected: thread still reports CPU time: " + t1);
+            } else {
             System.out.println("Okay: getThreadCpuTime() reported -1 as expected");
+            }
         } else {
             System.out.println("Skipping Thread CPU time test as it's not supported");
         }
 
         System.out.println("Calling getThreadUserTime ...");
         long t1 = mbean.getThreadUserTime(t.getId());
         if (t1 != -1) {
-            throw new RuntimeException("Invalid ThreadUserTime returned = " +
-                                       t1 + " expected = -1");
-        }
+            // At least on PPC, we know threads can still be around a short
+            // instant. In some stress scenarios we seem to grab times of
+            // new threads started with the same thread id. In these cases
+            // we get here.
+            System.out.println("Unexpected: thread still reports User time: " + t1);
+        } else {
         System.out.println("Okay: getThreadUserTime() reported -1 as expected");
+        }
 
         System.out.println("Calling getThreadInfo ...");
         ThreadInfo info = mbean.getThreadInfo(t.getId());
         System.out.println(info);
 
< prev index next >