JDK-8212220 : add code to verify results to metaspace/stressDictionary/StressDictionary.java
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-10-16
  • Updated: 2019-05-28
  • Resolved: 2018-10-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
12 b17Fixed
Description
Need to add some code to verify the results in:

vmTestbase/metaspace/stressDictionary/StressDictionary.java

in order to figure out why the test does not terminate
even when JTREG has reported "STATUS:Passed."

Here's my current proposal:

$ cat 8211211.diff.debug.txt.01
diff -r 934969c63223 test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java
@@ -123,11 +123,54 @@
             tasks.add(this.new RegularWorker());
         }
         ExecutorService executorService = Executors.newCachedThreadPool();
+        List<Future<Object>> results = null;
         try {
-            executorService.invokeAll(tasks);
+            results = executorService.invokeAll(tasks);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+
+        int act_results = results.size();
+        int exp_results = NUMBER_OF_CORRUPTING_THREADS +
+                          NUMBER_OF_NOT_CORRUPTING_THREADS;
+        if (act_results == exp_results) {
+            System.out.println("INFO: There are " + act_results + " results.");
+        } else {
+            throw new RuntimeException("Wrong # of results from invokeAll(); "
+                                       + "exp_results=" + exp_results + "; "
+                                       + "act_results=" + act_results + ".");
+        }
+
+        int cancelled_cnt = 0;
+        int not_done_cnt = 0;
+        for (int i = 0; i < act_results; i++) {
+            if (!results.get(i).isDone()) {
+                not_done_cnt++;
+                System.err.println("ERROR: task #" + i + " is not done.");
+            }
+            if (results.get(i).isCancelled()) {
+                cancelled_cnt++;
+                System.err.println("ERROR: task #" + i + " was canceled.");
+            }
+        }
+
+        if (cancelled_cnt == 0) {
+            System.out.println("INFO: no tasks were cancelled.");
+        }
+        if (not_done_cnt == 0) {
+            System.out.println("INFO: all tasks are done.");
+        }
+        if (cancelled_cnt != 0 && not_done_cnt != 0) {
+            throw new RuntimeException(cancelled_cnt
+                                       + " tasks were cancelled and "
+                                       + not_done_cnt
+                                       + " tasks are not done.");
+        } else if (cancelled_cnt != 0) {
+            throw new RuntimeException(cancelled_cnt
+                                       + " tasks were cancelled.");
+        } else if (not_done_cnt != 0) {
+            throw new RuntimeException(not_done_cnt + " tasks are not done.");
+        }
     }
 
     private byte[] generateAndCompile() {
Comments
With the fix for JDK-8212028 in place, the test is timing out much more frequently in the jdk/jdk CI. Here's an additional change to restore the timeout period to 20 minutes (5 minute timeout with the new 4X default TIMEOUT_FACTOR): $ diff 8211211.diff.debug.txt.0[12] 1c1 < diff -r 934969c63223 test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java --- > diff -r eadd0abbfdf4 test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java 3a4,12 > @@ -29,7 +29,7 @@ > * > * @library /vmTestbase /test/lib > * @run driver jdk.test.lib.FileInstaller . . > - * @run main/othervm metaspace.stressDictionary.StressDictionary -stressTime 30 > + * @run main/othervm/timeout=300 metaspace.stressDictionary.StressDictionary -stressTime 30 > */ > > package metaspace.stressDictionary;
23-10-2018