JDK-8143305 : sun/security/ec/TestEC.java fails intermittently
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • Submitted: 2015-11-19
  • Updated: 2017-10-13
  • Resolved: 2016-12-14
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
sun/security/ec/TestEC.java fails intermittently

----------System.err:(31/1929)----------
javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
	at sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:416)
	at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:173)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:995)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:949)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1356)
	at sun.security.ssl.SSLSocketImpl.bytesInCompletePacket(SSLSocketImpl.java:883)
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:144)
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:84)
	at CipherTest$Server.handleRequest(CipherTest.java:77)
	at JSSEServer$1.run(JSSEServer.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1158)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:632)
	at java.lang.Thread.run(Thread.java:747)
java.lang.Exception: *** Test 'Client JSSE - Server JSSE' failed ***
	at CipherTest.run(CipherTest.java:323)
	at CipherTest.main(CipherTest.java:445)
	at ClientJSSEServerJSSE.main(ClientJSSEServerJSSE.java:61)
	at TestEC.main0(TestEC.java:103)
	at TestEC.main(TestEC.java:70)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:520)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
	at java.lang.Thread.run(Thread.java:747)
Comments
It seem this bug mentioned 3 kind of issues: 1) ' javax.net.ssl.SSLException: Unsupported or unrecognized SSL message' in the bug description. 2) ' javax.net.ssl.SSLHandshakeException: RSA ServerKeyExchange does not comply to algorithm constraints' in the attachment files. 3) ' java.net.SocketTimeoutException: Read timed out' in the 2016-07-18 comments . This issue seem was fixed by JDK-8075484
16-12-2016

There are at least two different exceptions mixed in this bug. First one is "Unsupported or unrecognized SSL message" (please see the bug description), and second one is SocketTimeoutException. At the moment I am not sure that they are related. So, I am not sure that JDK-8075484 fixes "Unsupported or unrecognized SSL message" problem. But it is an interesting finding that JDK-8075484 may fix at least SocketTimeoutException problem here. We'll see.
14-12-2016

The native socketRead0 will cause the poll system call with when "fd" is ready for read, this will block the socket read. JDK-8075484 has update the natavie code to using no-blocking read by recv(s, buf, len, MSG_NONBLOCK) , so I think the issue was fixed.closed this bug.
14-12-2016

The testcase have below load flow: CipherTest.java:381 -> OutputStream.java:75 -> AppOutputStream.java:67 ->SSLSocketImpl.java:728 ->SSLSocketInputRecord.java:154 -> SSLSocketInputRecord.java:425 -> SocketInputStream.java:141->SocketInputStream.java:170 ->SocketInputStream.java:116 -> SocketInputStream.java:94: private native int socketRead0 In the end, it will load the native socketRead0 function in SocketInputStream.java line 94, I find there is one same timeout issue happend on SocketInputStream.java : socketRead0 function ,and it has been tracked by JDK-8075484 and fixed in jdk9 137 , the code was check in on 2016-09-21.For currently issue was latest happend on 2016-07-18 it was happened before the fix code checked in, so I guess it was fixed by JDK-8075484.
08-12-2016

I suspect this is one of those intermittent failures which we have been seeing for long time. Possible solution may be to update the test to use SSLSocketTemplate class. Xuelei is updating this class, so please wait for him to finish it (see JDK-8170329, there are example of how SSLSocketTemplate can be used).
06-12-2016

Test sun/security/ec/TestEC.java will load below tests : new TestECDH().main(p); new TestECDSA().main(p); new TestCurves().main(p); new TestKeyFactory().main(p); new TestECGenSpec().main(p); new ReadPKCS12().main(p); new ReadCertificates().main(p); new ClientJSSEServerJSSE().main(p); For each test there is no flag to hint which test was finished.It hard to check which test was run by the log. After analysis,the issue was failed at ClientJSSEServerJSSE().main(p),It seem only happend on Solaris11, As the comments in code , the ClientJSSEServerJSSE fails on Solaris 11 when both SunEC and SunPKCS11-Solaris providers are enabled. It need to verify whether it is the root reason.
06-12-2016

Below issue with the same exception "javax.net.ssl.SSLException:Unsupported or unrecognized SSL message " JDK-8135105 JDK-8141593 JDK-8152745
19-05-2016

A better TestEC.jtr
05-03-2016

I just reconfirmed that sun/security/ec/TestEC.java fails with a clean build of jdk8u tip, but succeeds when run with jdk8u72. I will attach the jtr file created with security debug info.
05-03-2016

Martin - I believe you're running into a different issue than that reported initially. your issue stems from this exception : javax.net.ssl.SSLHandshakeException: RSA ServerKeyExchange does not comply to algorithm constraints Can you please confirm that your testcase is up to date? Esp, in this area : http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/file/53abec8a0aaf/test/sun/security/ec/TestEC.java#l64 line 64,65 set up more lenient constraints. Test is run in ovm mode which is a must. If you still see a failure, please supply/attach a verbose logfile with -Djava.security.debug=all switched on.
21-02-2016

I bisected the failure in jdk8u to this changeset: changeset: 11342:1a863c064c33 11337:5b4d8eab92de user: coffeys date: 2015-11-03 19:07 +0000 8141287: Add MD5 to jdk.certpath.disabledAlgorithms - Take 2 Reviewed-by: xuelei Perhaps the confusion of differing behavior between Oracle JDK and pure openjdk is contributing to the multiple "takes", and to the "intermittent" perception? Here's excerpt from the jtreg output: Passed SSL_DH_anon_WITH_DES_CBC_SHA in TLSv1 mode ** Failed SSL_RSA_EXPORT_WITH_DES40_CBC_SHA in SSLv3 mode** ** Failed SSL_RSA_EXPORT_WITH_DES40_CBC_SHA in SSLv3 mode with DSA client authentication** ** Failed SSL_RSA_EXPORT_WITH_DES40_CBC_SHA in SSLv3 mode with RSA client authentication** Passed SSL_DH_anon_WITH_DES_CBC_SHA in TLSv1.1 mode STDERR: javax.net.ssl.SSLHandshakeException: RSA ServerKeyExchange does not comply to algorithm constraints at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:690) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:252) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123) at java.io.OutputStream.write(OutputStream.java:75) at CipherTest$Client.sendRequest(CipherTest.java:378) at JSSEClient.runTest(JSSEClient.java:57) at CipherTest$Client.run(CipherTest.java:365) at java.lang.Thread.run(Thread.java:745) javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:928) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at sun.security.ssl.AppInputStream.read(AppInputStream.java:71) at CipherTest$Server.handleRequest(CipherTest.java:77) at JSSEServer$1.run(JSSEServer.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) javax.net.ssl.SSLHandshakeException: RSA ServerKeyExchange does not comply to algorithm constraints at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:690) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:252) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123) at java.io.OutputStream.write(OutputStream.java:75) at CipherTest$Client.sendRequest(CipherTest.java:378) at JSSEClient.runTest(JSSEClient.java:57) at CipherTest$Client.run(CipherTest.java:365) at java.lang.Thread.run(Thread.java:745) javax.net.ssl.SSLHandshakeException: RSA ServerKeyExchange does not comply to algorithm constraints at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:690) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:252) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123) at java.io.OutputStream.write(OutputStream.java:75) at CipherTest$Client.sendRequest(CipherTest.java:378) at JSSEClient.runTest(JSSEClient.java:57) at CipherTest$Client.run(CipherTest.java:365) at java.lang.Thread.run(Thread.java:745) javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:928) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at sun.security.ssl.AppInputStream.read(AppInputStream.java:71) at CipherTest$Server.handleRequest(CipherTest.java:77) at JSSEServer$1.run(JSSEServer.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:928) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at sun.security.ssl.AppInputStream.read(AppInputStream.java:71) at CipherTest$Server.handleRequest(CipherTest.java:77) at JSSEServer$1.run(JSSEServer.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) java.lang.Exception: *** Test 'Client JSSE - Server JSSE' failed *** at CipherTest.run(CipherTest.java:323) at CipherTest.main(CipherTest.java:445) at ClientJSSEServerJSSE.main(ClientJSSEServerJSSE.java:81) at TestEC.main0(TestEC.java:102) at TestEC.main(TestEC.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92) at java.lang.Thread.run(Thread.java:745) JavaTest Message: Test threw exception: java.lang.Exception: *** Test 'Client JSSE - Server JSSE' failed ***
20-02-2016

I tried this test against various JDKs. In jdk9 it passes with openjdk9. In jdk8u it passes with Oracle jdk8u72, but it fails with an openjdk I built myself (at head or at tag jdk8u72-b15). Did jdk8u release testing overlook testing with stock openjdk, and only test Oracle JDK?
18-02-2016