[ https://issues.apache.org/jira/browse/JAMES-4045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856066#comment-17856066 ]
Romain Moreau commented on JAMES-4045: -------------------------------------- Hi, I attached the [^test-run.log] of a failed run of the test in description; it seems like some components are consuming the encrypted data. > Executing TLS a lot of times and will sometimes result in an exception > ---------------------------------------------------------------------- > > Key: JAMES-4045 > URL: https://issues.apache.org/jira/browse/JAMES-4045 > Project: James Server > Issue Type: Bug > Components: SMTPServer > Affects Versions: 3.9.0 > Reporter: Romain Moreau > Priority: Major > Attachments: test-run.log > > > With a {{{}SMTPSClient{}}}, if you try many times to {{{}connect{}}}, > {{EHLO}} then {{{}execTLS{}}}, {{execTLS}} will sometimes throw an exception. > This can be reproduced by simply adding a loop to this existing test: > {code:java} > @Test > void startTlsShouldReturnTrueWhenServerSupportsIt() throws Exception { > server = createServer(createProtocol(Optional.empty()), > Encryption.createStartTls(BogusSslContextFactory.getServerContext())); > smtpsClient = createClient(); > server.bind(); > for (var i = 0; i < 5_000; i++) { > InetSocketAddress bindedAddress = new > ProtocolServerUtils(server).retrieveBindedAddress(); > smtpsClient.connect(bindedAddress.getAddress().getHostAddress(), > bindedAddress.getPort()); > smtpsClient.sendCommand("EHLO localhost"); > boolean execTLS = smtpsClient.execTLS(); > assertThat(execTLS).isTrue(); > } > } > {code} > When the issue happens, the SMTP server seems to close the connection > unexpectedly and {{execTLS}} will fail with the following exception: > {noformat} > javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake > at > java.base/sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1715) > at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1515) > at > java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1422) > at > java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455) > at > java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426) > at > org.apache.commons.net.smtp.SMTPSClient.performSSLNegotiation(SMTPSClient.java:300) > at org.apache.commons.net.smtp.SMTPSClient.execTLS(SMTPSClient.java:197) > at > org.apache.james.protocols.smtp.netty.NettyStartTlsSMTPServerTest.startTlsShouldReturnTrueWhenServerSupportsIt(NettyStartTlsSMTPServerTest.java:169) > at java.base/java.util.ArrayList.forEach(ArrayList.java:1597) > at java.base/java.util.ArrayList.forEach(ArrayList.java:1597) > Caused by: java.io.EOFException: SSL peer shut down incorrectly > at > java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:494) > at > java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:483) > 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:1507) > ... 74 more > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org