You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2016/10/13 08:17:20 UTC
[jira] [Resolved] (DIRMINA-1047) NullPointerException in
AbstractIoSession.destroy()
[ https://issues.apache.org/jira/browse/DIRMINA-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny resolved DIRMINA-1047.
----------------------------------------
Resolution: Fixed
Marked as fixed.
> NullPointerException in AbstractIoSession.destroy()
> ---------------------------------------------------
>
> Key: DIRMINA-1047
> URL: https://issues.apache.org/jira/browse/DIRMINA-1047
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.15
> Environment: Any
> Reporter: Carl Wicklow
> Fix For: 2.0.16
>
>
> After upgrading to *v2.0.15*, we get this NPE ...
> {noformat}
> java.lang.NullPointerException
> at org.apache.mina.core.session.AbstractIoSession.destroy(AbstractIoSession.java:369)
> at org.apache.mina.core.session.AbstractIoSession.closeNow(AbstractIoSession.java:350)
> at org.apache.mina.core.session.DefaultIoSessionDataStructureFactory$DefaultWriteRequestQueue.poll(DefaultIoSessionDataStructureFactory.java:222)
> at org.apache.mina.core.polling.AbstractPollingIoProcessor.flushNow(AbstractPollingIoProcessor.java:827)
> at org.apache.mina.core.polling.AbstractPollingIoProcessor.flush(AbstractPollingIoProcessor.java:767)
> at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$700(AbstractPollingIoProcessor.java:68)
> at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1125)
> at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {noformat}
> If I'm reading it right, the destroy also needs to allow that the writeRequest returned by the poll() of the WriteRequestQueue may return null if the queue is empty.
> In our case the destroy was invoked after polling a CLOSE_REQUEST caused by an earlier closeOnFlush(), and the write request queue was empty.
> {code:title=AbstractIoSession.java|borderStyle=solid}
> protected void destroy() {
> if (writeRequestQueue != null) {
> while (!writeRequestQueue.isEmpty(this)) {
> WriteRequest writeRequest = writeRequestQueue.poll(this);
> WriteFuture writeFuture = writeRequest.getFuture();
>
> // The WriteRequest may not always have a future : The CLOSE_REQUEST
> // and MESSAGE_SENT_REQUEST don't.
> if (writeFuture != null) {
> writeFuture.setWritten();
> }
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)