mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Franz Seidl (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DIRMINA-679) NullPointerException in ProtocolCodecFilter.filterWrite
Date Sat, 17 Oct 2009 23:09:31 GMT

    [ https://issues.apache.org/jira/browse/DIRMINA-679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766979#action_12766979
] 

Franz Seidl commented on DIRMINA-679:
-------------------------------------

I've encountered similar behavior, i. e. the same stacktrace with slightly (1-3 lines) different
line numbers. 

Tried 2.0.0-M6 and Trunk (Revision 826281).

The application uses DefaultIoFilterChain and ProtocolCodecFilter. The IoFilterChain instance
associated with an IoSession is modified after its initial creation using the method 
replace(String name, IoFilter newFilter) of DefaultIoFilterChain.

In contrast to the add...() and remove() methods, the three replace() methods do not invoke
the onPreAdd(), onPostAdd(), onPreRemove() and onPostRemove() lifecycle methods on the IoFilter
instance. But this is where ProtocolCodecFilter registers and deregisters its ProtocolEncoder
and ProtocolDecoder with the IoSession.
If the previous IoFilter has been a ProtocolCodecFilter, too, its ProtocolEncoder and -Decoder
are still in use after the replacement. If the previous IoFilter has been something else (in
my case an IoFilterAdapter used as dummy), the ProtocolEncoder is not in place when needed
=> NullPointerException.

Avoiding replace() and do a remove()/add() instead might serve as a workaround.

I've modified the replace() methods to make it work for me and will attach the diff to this
ticket. Please note, that only the first of the three methods is called from my code and none
of them could be called "tested" without lying. ;-) (In fact, I have not run the second and
the third even once.)



> NullPointerException in ProtocolCodecFilter.filterWrite
> -------------------------------------------------------
>
>                 Key: DIRMINA-679
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-679
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-M4
>            Reporter: John J. Franey
>             Fix For: 2.0.0-RC1
>
>
> Looks like filterWrite obtains a reference from the session's attributes, but the desired
attribute is not there.
> I am running max of 250 datagram sockets under load test for my application.  Connections
last about 60 seconds and released.  A new connection is made to keep the total number of
active connections up to 250.
> Over a period of two hours running this load test, this exception occured twice.
> org.apache.mina.filter.codec.ProtocolEncoderException: java.lang.NullPointerException
> 	at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:312)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:506)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$7(DefaultIoFilterChain.java:501)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:814)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:740)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:506)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:498)
> 	at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:418)
> 	at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:359)
> ....
> Caused by: java.lang.NullPointerException
> 	at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:297)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:814)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:741)
> 	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:498)
> 	at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:359)
> ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message