[ https://issues.apache.org/jira/browse/DIRMINA-1082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17213692#comment-17213692 ]
Zsolt Kúti commented on DIRMINA-1082: ------------------------------------- I am experimenting with a simple client/server app. It works fine without SSLFilter. As soon as the filter is applied to connector and acceptor I get: {quote}...MessageHandler exceptionCaught WARNING: javax.net.ssl.SSLException: Improper close state: Status = OK HandshakeStatus = NEED_WRAPjavax.net.ssl.SSLException: Improper close state: Status = OK HandshakeStatus = NEED_WRAPbytesConsumed = 0 bytesProduced = 7 sequenceNumber = 0 at org.apache.mina.filter.ssl.SslHandler.closeOutbound(SslHandler.java:498) at org.apache.mina.filter.ssl.SslFilter.initiateClosure(SslFilter.java:762) at org.apache.mina.filter.ssl.SslFilter.filterClose(SslFilter.java:693) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:776) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:49) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:1155) at org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:146) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:776) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:769) at org.apache.mina.core.session.AbstractIoSession.closeNow(AbstractIoSession.java:353) at org.apache.mina.core.service.IoHandlerAdapter.inputClosed(IoHandlerAdapter.java:102) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.inputClosed(DefaultIoFilterChain.java:997) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextInputClosed(DefaultIoFilterChain.java:735) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.inputClosed(DefaultIoFilterChain.java:1119) at org.apache.mina.core.filterchain.IoFilterAdapter.inputClosed(IoFilterAdapter.java:154) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextInputClosed(DefaultIoFilterChain.java:735) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.inputClosed(DefaultIoFilterChain.java:1119) at org.apache.mina.core.filterchain.IoFilterAdapter.inputClosed(IoFilterAdapter.java:154) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextInputClosed(DefaultIoFilterChain.java:735) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireInputClosed(DefaultIoFilterChain.java:728) {quote} Mina version 2.1.4, AdoptOpenJDK 11.0.8. Interestingly on AODK 1.8.0-242 no connection happens within the usually set timeout. > SSLHandler calling wrap method after closeOutBound() on SSLEngine > ----------------------------------------------------------------- > > Key: DIRMINA-1082 > URL: https://issues.apache.org/jira/browse/DIRMINA-1082 > Project: MINA > Issue Type: Bug > Components: Core > Affects Versions: 2.0.16 > Reporter: Kamal Rathod > Assignee: Emmanuel Lécharny > Priority: Major > > Hi, > I am trying to connect through SSL and Proxy and getting below error. > _ERROR quickfix.mina.initiator.InitiatorIoHandler - Socket : > javax.net.ssl.SSLException: Improper close state: Status = OK HandshakeStatus > = NEED_WRAP_ > _bytesConsumed = 0 bytesProduced = 87_ > _javax.net.ssl.SSLException: Improper close state: Status = OK > HandshakeStatus = NEED_WRAP_ > _bytesConsumed = 0 bytesProduced = 87_ > _at org.apache.mina.filter.ssl.SslHandler.closeOutbound(SslHandler.java:500) > ~[mina-core.jar:?]_ > _at org.apache.mina.filter.ssl.SslFilter.initiateClosure(SslFilter.java:742) > ~[mina-core.jar:?]_ > _at org.apache.mina.filter.ssl.SslFilter.filterClose(SslFilter.java:677) > ~[mina-core.jar:?]_ > _at > org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:648) > ~[mina-core.jar:?]_ > > I had a look at closeOutBound() method of SslHandler.java and suspect bug > there. > Line 484: sslEngine.closeOutBound() > Line 490: sslEngine.wrap(emptyBuffer.buf(), outNetBuffer.buf()); > > In the scenario the sslEngine is closed first and then the wrap method is > called. > As per java docs: > _In all cases, closure handshake messages are generated by the engine, and > {{wrap()}} should be repeatedly called until the resulting > {{SSLEngineResult}}'s status returns "CLOSED", or > [{{isOutboundDone()}}|https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html#isOutboundDone()] > returns true. All data obtained from the {{wrap()}} method should be sent to > the peer._ > _[{{closeOutbound()}}|https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html#closeOutbound()] > is used to signal the engine that the application will not be sending any > more data._ > So as per docs, wrap should be called repeatedly and then closeOutbound() > method, but in code its reverse, after closeOutbound wrap is called. > Can someone please check and comment on this? -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org