RFR: 8277353: java/security/MessageDigest/ThreadSafetyTest.java test times out

Alexey Bakhtin abakhtin at openjdk.java.net
Thu Dec 2 12:54:24 UTC 2021


On Wed, 1 Dec 2021 19:29:36 GMT, Sibabrata Sahoo <ssahoo at openjdk.org> wrote:

>> Can you lower the `threadsFactor` or `duration`? Or set an upper limit for `nTasks`?
>
>> Can you lower the `threadsFactor` or `duration`? Or set an upper limit for `nTasks`?
> 
> I can reduce the threadFactor and duration to close to half(threadsFactor=2 and duration=2 Or hardcode nTasks=20) and i think there still will be enough threads to verify threadsafety. In that case default JTREG timeout period should be enough and no need for any additional timeout with @run tag.

Hi @sisahoo,
Yes, I think the number of threads and duration can be lowered. For example like this:

diff --git a/test/jdk/java/security/MessageDigest/ThreadSafetyTest.java b/test/jdk/java/security/MessageDigest/ThreadSafetyTest.java
index 41ecbca2677..f179bd54257 100644
--- a/test/jdk/java/security/MessageDigest/ThreadSafetyTest.java
+++ b/test/jdk/java/security/MessageDigest/ThreadSafetyTest.java
@@ -25,7 +25,7 @@
  * @test
  * @bug 8241960
  * @summary Confirm that java.security.MessageDigest is thread-safe after clone.
- * @run main/othervm ThreadSafetyTest 5 4
+ * @run main/othervm ThreadSafetyTest 5 2
  */
 
 import java.security.MessageDigest;
@@ -56,7 +56,7 @@ public class ThreadSafetyTest {
             duration = Integer.parseInt(args[1]);
         }
         int nProcessors = Runtime.getRuntime().availableProcessors();
-        int nTasks = nProcessors * threadsFactor;
+        int nTasks = Math.min(nProcessors, 4) * threadsFactor;
         System.out.println("Testing with " + nTasks + " threads on " +
                            nProcessors + " processors for " + duration +

-------------

PR: https://git.openjdk.java.net/jdk/pull/6626


More information about the security-dev mailing list