eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.24k stars 714 forks source link

CryptoTests cryptotest/tests/SignatureTests.java timeout in java.math.BigInteger.implSquareToLen #16711

Open pshipton opened 1 year ago

pshipton commented 1 year ago

https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_extended.functional_x86-64_linux_Nightly_testList_0/394/ - ub16x64j96 CryptoTests_0 cryptotest/tests/SignatureTests.java

timeout, no diagnostic files.

133)    SunEC:  SHA1withECDSA~SHA1withECDSA  (Signature)

"MainThread" prio=5 Id=22 RUNNABLE
    at java.base@17.0.6-internal/java.math.BigInteger.implSquareToLen(BigInteger.java:2212)
    at java.base@17.0.6-internal/java.math.BigInteger.squareToLen(BigInteger.java:2124)
    at java.base@17.0.6-internal/java.math.BigInteger.implMontgomerySquare(BigInteger.java:2866)
    at java.base@17.0.6-internal/java.math.BigInteger.montgomerySquare(BigInteger.java:2823)
    at java.base@17.0.6-internal/java.math.BigInteger.oddModPow(BigInteger.java:3093)
    at java.base@17.0.6-internal/java.math.BigInteger.modPow(BigInteger.java:2754)
    at java.base@17.0.6-internal/java.math.BigInteger.passesMillerRabin(BigInteger.java:1122)
    at java.base@17.0.6-internal/java.math.BigInteger.primeToCertainty(BigInteger.java:978)
    at java.base@17.0.6-internal/java.math.BitSieve.retrieve(BitSieve.java:203)
    at java.base@17.0.6-internal/java.math.BigInteger.largePrime(BigInteger.java:847)
    at java.base@17.0.6-internal/java.math.BigInteger.probablePrime(BigInteger.java:785)
    at java.base@17.0.6-internal/sun.security.rsa.RSAKeyPairGenerator.generateKeyPair(RSAKeyPairGenerator.java:173)
    at java.base@17.0.6-internal/java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at java.base@17.0.6-internal/java.security.KeyPairGenerator.genKeyPair(KeyPairGenerator.java:495)
    at app//cryptotest.utils.KeysNaiveGenerator.getRsaKeyPair(KeysNaiveGenerator.java:165)
    at app//cryptotest.utils.KeysNaiveGenerator.getRsaPrivateKey(KeysNaiveGenerator.java:169)
    at app//cryptotest.tests.SignatureTests.checkAlgorithm(SignatureTests.java:85)
    at app//cryptotest.utils.AlgorithmTest.mainLoop(AlgorithmTest.java:79)
    at app//cryptotest.tests.SignatureTests.main(SignatureTests.java:68)
pshipton commented 1 year ago

https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_extended.functional_s390x_linux_Nightly_testList_1/415 - ub20-390-3 CryptoTests_0 cryptotest/tests/SignatureTests.java

72) SunRsaSign:     SHA384withRSA~OID.1.2.840.113549.1.1.12  (Signature)

"MainThread" prio=5 Id=22 RUNNABLE
    at java.base@17.0.6-internal/java.math.BigInteger.implSquareToLen(BigInteger.java:2202)
    at java.base@17.0.6-internal/java.math.BigInteger.squareToLen(BigInteger.java:2124)
    at java.base@17.0.6-internal/java.math.BigInteger.square(BigInteger.java:2093)
    at java.base@17.0.6-internal/java.math.BigInteger.square(BigInteger.java:2076)
    at java.base@17.0.6-internal/java.math.BigInteger.lucasLehmerSequence(BigInteger.java:1070)
    at java.base@17.0.6-internal/java.math.BigInteger.passesLucasLehmer(BigInteger.java:998)
    at java.base@17.0.6-internal/java.math.BigInteger.primeToCertainty(BigInteger.java:978)
    at java.base@17.0.6-internal/java.math.BitSieve.retrieve(BitSieve.java:203)
    at java.base@17.0.6-internal/java.math.BigInteger.largePrime(BigInteger.java:847)
    at java.base@17.0.6-internal/java.math.BigInteger.probablePrime(BigInteger.java:785)
    at java.base@17.0.6-internal/sun.security.rsa.RSAKeyPairGenerator.generateKeyPair(RSAKeyPairGenerator.java:187)
    at java.base@17.0.6-internal/java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:721)
    at java.base@17.0.6-internal/java.security.KeyPairGenerator.genKeyPair(KeyPairGenerator.java:495)
    at app//cryptotest.utils.KeysNaiveGenerator.getRsaKeyPair(KeysNaiveGenerator.java:165)
    at app//cryptotest.utils.KeysNaiveGenerator.getRsaPrivateKey(KeysNaiveGenerator.java:169)
    at app//cryptotest.tests.SignatureTests.checkAlgorithm(SignatureTests.java:85)
    at app//cryptotest.utils.AlgorithmTest.mainLoop(AlgorithmTest.java:79)
    at app//cryptotest.tests.SignatureTests.main(SignatureTests.java:68)
pshipton commented 1 year ago

@0xdaryl it seems OpenJ9 is too slow to complete this newly added test. I notice jdk17 implSquareToLen() has an @IntrinsicCandidate annotation, while in jdk11 it's @HotSpotIntrinsicCandidate.

@llxia can we increase the timeout setting for this test? timeout set to 120000ms

pshipton commented 1 year ago

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_aarch64_linux_Nightly_testList_0/99 - cent8-aarch64-1 CryptoTests_0 cryptotest/tests/SignatureTests.java

34) SUN:    SHA3-256withDSA~OID.2.16.840.1.101.3.4.3.6   (Signature)

"MainThread" prio=5 Id=27 RUNNABLE
    at java.base@19.0.2-internal/java.math.BigInteger.implMulAdd(BigInteger.java:3320)

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_aarch64_mac_Nightly_testList_0/103

90) SunRsaSign:     SHA512withRSA~OID.1.2.840.113549.1.1.13  (Signature)

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_ppc64_aix_Nightly_testList_1/100

40) SUN:    SHA256withDSA~OID.2.16.840.1.101.3.4.3.2     (Signature)

"MainThread" prio=5 Id=35 RUNNABLE
    at java.base@19.0.2-internal/java.math.BigInteger.implSquareToLen(BigInteger.java:2316)

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_ppc64le_linux_Nightly_testList_1/101

46) SUN:    NONEwithDSA~RawDSA   (Signature)

"MainThread" prio=5 Id=35 RUNNABLE
    at java.base@19.0.2-internal/java.math.BigInteger.implMulAddCheck(BigInteger.java:3296)

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_s390x_linux_Nightly_testList_1/102

29) SUN:    SHA512withDSA~2.16.840.1.101.3.4.3.4     (Signature)

"MainThread" prio=5 Id=23 RUNNABLE
    at java.base@19.0.2-internal/java.math.BigInteger.montReduce(BigInteger.java:3241)

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_x86-64_linux_Nightly_testList_1/100

25) SUN:    SHA3-512withDSA~OID.2.16.840.1.101.3.4.3.8   (Signature)

"MainThread" prio=5 Id=23 RUNNABLE
    at java.base@19.0.2-internal/java.math.BigInteger.implSquareToLen(BigInteger.java:2316)

https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_x86-64_mac_Nightly_testList_0/99

91) SunRsaSign:     SHA512withRSA~1.2.840.113549.1.1.13  (Signature)
pshipton commented 1 year ago

cryptotest/CryptoTest.java is also timing out https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_ppc64_aix_Nightly_testList_1/100 https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_ppc64le_linux_Nightly_testList_1/101 https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_s390x_linux_Nightly_testList_1/102 https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_x86-64_linux_Nightly_testList_1/100

pshipton commented 1 year ago

and cryptotest/tests/SecureRandomTests.java https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_extended.functional_x86-64_linux_Nightly_testList_1/100

pshipton commented 1 year ago

The jdk19 timeouts are also happening on Adoptium builds.

llxia commented 1 year ago

I can set -timeoutFactor:2 (instead of 1). But I am not sure if it is the best way to do it. https://openj9-jenkins.osuosl.org/job/Grinder/2022/

llxia commented 1 year ago

Increase timeout for CryptoTests: https://github.com/adoptium/aqa-tests/pull/4339

0xdaryl commented 1 year ago

I notice jdk17 implSquareToLen() has an @IntrinsicCandidate annotation, while in jdk11 it's @HotSpotIntrinsicCandidate.

Interesting. I believe our intrinsics matching code is only looking for the former, not the latter. But it is the former that might be the issue in this case. We'll investigate the slowness, but not for 0.38.

0xdaryl commented 1 year ago

@BradleyWood : please investigate the slowdown here. I moved this to 0.40.

BradleyWood commented 1 year ago

@0xdaryl it seems OpenJ9 is too slow to complete this newly added test. I notice jdk17 implSquareToLen() has an @IntrinsicCandidate annotation, while in jdk11 it's @HotSpotIntrinsicCandidate.

I don't think implSquareToLen intrinsic was ever implemented in OpenJ9 on any platform. I think we should open an issue to implement it, and any other unimplemented intrinsics.

hzongaro commented 11 months ago

Reassigning to @jmesyou, as he's working on issue #17778.

I'm not sure whether we need both issues, or if #17778 will act as an epic issue with this as a subtask. I'll leave it for him to decide.

hzongaro commented 11 months ago

I'm assuming this won't be ready for the 0.41 code split, so I'll move it out to 0.43.