Hello all, I want to share my findings regarding the camel-mina2 component (camel 2.16.2). From my understanding, both of them are bugs, but maybe someone could provide a feedback and/or create a jira ticket.
1. Thread leak for camel-mina2 consumers The camel-mina2 consumer (org.apache.camel.component.mina2.Mina2Consumer.doStart()) internally start a Mina2 IoAcceptor (org.apache.mina.core.service.IoAcceptor), but the org.apache.camel.component.mina2.Mina2Consumer.doStop() do not invoke acceptor.dispose(true); to release the threadpool started by Mina2. Current behavior: While stopping the web application, the threadpool started by Mina2 IoAcceptor will not be stopped, so we have several thread which do not properly shutdown. Current workaround: I create custom CamelShutdownStrategy and collect all Mina2Consumer and invoke Mina2consumer.getAcceptor.dispose(true); OR as an alternative create a dedicated consumer and overwrite the stop method of the Mina2 consumer as seen here: https://github.com/oehf/ipf/commit/12fdde8df7ebbbb7cd9966aadeab3ea3bed8fe75 Suggested bugfix: Call the IoAcceptor dispose method in the Mina2Consumer stop processing. 2. Mina2Consumer exception handler do close session also for IOException The camel-mina2 consumer Exception handler (org.apache.camel.component.mina2.Mina2Consumer.ReceiveHandler.exceptionCaught(IoSession, Throwable) Is an implementation of the Mina2 interface org.apache.mina.core.service.IoHandler. The Javadoc Mina2 documentation of exceptionCaught explicitly mention, that Mina2 will close the connection for all IOExceptions automatically. But camel-mina2 seems to close the connection for any kind of exception. Current behavior: If an error occurs on the transport layer (e.g. secure TCP connection where the certificate was not trusted and a SSLException occure), I saw the following warning: org.apache.camel.component.mina2.Mina2Consumer#exceptionCaught(376) - Closing session as an exception was thrown from MINA And also an error from mina2: org.apache.mina.filter.ssl.SslHandler#destroy(210) - Unexpected exception from SSLEngine.closeInbound(). " javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack? >From a functional perspective, beside the annoying log entries, it looks like >the SSL error details are sometime not send properly back to the client. Current workaround: I don't have one. Suggested bugfix: Implement the Mina2Consumer exception handling similar to org.apache.mina.handler.stream.StreamIoHandler.exceptionCaught(IoSession, Throwable) and do not handle IoException and simply rethrow them. Any feedback on my findings are welcome. Regards, Thomas InterComponentWare AG: Vorstand: Peter Kirschbauer (Vors.), Matthias Gl?ck Aufsichtsratsvors.: Prof. Dr. Christof Hettich Unternehmenssitz: 69190 Walldorf, Altrottstra?e 31 AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516