Hi Ben, We spent some time on this exact issue.
We suspect that the root cause of the trouble is a race condition triggered by the amount of extra time it takes for the Android SSL Engine to secure the connection. I suspect that this part of the MINA code doesn't cause problems for PC users since the SSL Engine in regular Java (not Dalvik) is much faster than Android or behaves differently under the hood. I've attached the diff file. Hope this helps! Chris On Tue, Nov 26, 2013 at 8:14 PM, Ben Bader <[email protected]> wrote: > Hi Mina users, > > I've encountered a strange NPE when attempting to use Mina 2.0.7 on > Android. When not using an SslFilter, everything is great; with SSL, the > app hangs during the handshake, and eventually crashes with an NPE inside > of SslHandler. > > I've attempted to track down the issue, but haven't had much luck; it's not > clear to me at the moment how to go about debugging the > SslFilter/SslHandler interactions. Has anyone else had success using Mina > + SSL on Android? If so, what's the secret? > > I appreciate any insight you can offer. > > Thanks, > Ben > > Below is the relevant stack trace: > EXCEPTION : > java.lang.NullPointerException > at > org.apache.mina.filter.ssl.SslHandler.fetchAppBuffer(SslHandler.java:389) > at > org.apache.mina.filter.ssl.SslFilter.handleAppDataRead(SslFilter.java:702) > at org.apache.mina.filter.ssl.SslFilter.handleSslData(SslFilter.java:697) > at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:471) > at > > org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) > at > > org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47) > at > > org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765) > at > > org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) > at > > org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) > at > > org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:410) > at > > org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:710) > at > > org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664) > at > > org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653) > at > > org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67) > at > > org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124) > at > > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) > at > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) > at > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) > at java.lang.Thread.run(Thread.java:856) > -- _____________________ Christopher Deschenes Entrasoft *Web, mobile, and scientific software development* (c) 781-334-7016
