On Thu, 28 Jan 2021 20:12:14 GMT, Clive Verghese <cvergh...@openjdk.org> wrote:

>> Redo for 8237578: JDK-8214339 (SSLSocketImpl wraps SocketException) appears 
>> to not be fully fixed
>> 
>> This also fixes JDK-8259516: Alerts sent by peer may not be received 
>> correctly during TLS handshake
>
> Clive Verghese has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Address review comments

Please make sure all tier1 and tier2 tests passed on all supported platforms.  
Except the failed I commented in the update, 
javax/net/ssl/SSLSession/TestEnabledProtocols.java is also failed with a 
similar stack on Windows.  Maybe, the pull request command "/test tier1" and  
"/test tier2" could help speed up the testing.

test/jdk/sun/security/ssl/SSLContextImpl/ShouldThrowSSLExceptionWhenPeerClosesSocket.java
 line 137:

> 135:             // Ignore exception as this is expected.
> 136:         }
> 137:     }

The test cannot pass tier2 test on Windows.

java.net.SocketException: An established connection was aborted by the software 
in your host machine
        at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:420)
        at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
        at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
        at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1045)
        at 
java.base/sun.security.ssl.SSLSocketOutputRecord.flush(SSLSocketOutputRecord.java:266)
        at 
java.base/sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:89)
        at 
java.base/sun.security.ssl.CertificateRequest$T12CertificateRequestProducer.produce(CertificateRequest.java:629)
        at 
java.base/sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:440)
        at 
java.base/sun.security.ssl.ClientHello$T12ClientHelloConsumer.consume(ClientHello.java:1120)
        at 
java.base/sun.security.ssl.ClientHello$ClientHelloConsumer.onClientHello(ClientHello.java:853)
        at 
java.base/sun.security.ssl.ClientHello$ClientHelloConsumer.consume(ClientHello.java:812)
        at 
java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
        at 
java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480)
        at 
java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458)
        at 
java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:199)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
        at 
java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1501)
        at 
java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1415)
        at 
java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:450)
        at 
java.base/sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:915)
        at 
java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1006)
        at 
java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:966)
        at 
ShouldThrowSSLExceptionWhenPeerClosesSocket.runServerApplication(ShouldThrowSSLExceptionWhenPeerClosesSocket.java:131)
        at SSLSocketTemplate.doServerSide(SSLSocketTemplate.java:280)
        at SSLSocketTemplate.startServer(SSLSocketTemplate.java:584)
        at SSLSocketTemplate.bootup(SSLSocketTemplate.java:498)
        at SSLSocketTemplate.run(SSLSocketTemplate.java:83)
        at 
ShouldThrowSSLExceptionWhenPeerClosesSocket.main(ShouldThrowSSLExceptionWhenPeerClosesSocket.java:292)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:831)
        Suppressed: java.net.SocketException: An established connection was 
aborted by the software in your host machine
                at 
java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:325)
                at 
java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
                at 
java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
                at 
java.base/java.net.Socket$SocketInputStream.read(Socket.java:976)
                at 
java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
                at 
java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
                at 
java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
                at 
java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
                at 
java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1501)
                at 
java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1696)
                at 
java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:460)
                ... 15 more

test/jdk/sun/security/ssl/SSLSocketImpl/SocketExceptionForSocketIssues.java 
line 84:

> 82:         } catch (SocketException se) {
> 83:             // the expected exception, ignore it
> 84:             System.err.println("server exception: " + se);

The test failed with on Linux/Windows/MacOSX:
javax.net.ssl.SSLHandshakeException: Insufficient buffer remaining for AEAD 
cipher fragment (2). Needs to be more than tag size (16)
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
        at 
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:369)
        at 
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:312)
        at 
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:307)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:134)
        at 
java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1501)
        at 
java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1696)
        at 
java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:460)
        at 
java.base/sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:915)
        at 
java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1285)
        at java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:242)
        at 
java.base/sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:321)
        at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:325)
        at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:159)
        at 
java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248)
        at java.base/java.io.BufferedWriter.flush(BufferedWriter.java:257)
        at 
SocketExceptionForSocketIssues.test(SocketExceptionForSocketIssues.java:79)
        at 
SocketExceptionForSocketIssues.main(SocketExceptionForSocketIssues.java:45)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:831)
        Suppressed: java.net.SocketException: Broken pipe
                at 
java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:420)
                at 
java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
                at 
java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
                at 
java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1045)
                at 
java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
                at 
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:400)
                ... 22 more

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

Changes requested by xuelei (Reviewer).

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

Reply via email to