NPE in OrderedThreadPoolExecutor and UnorderedThreadPoolExecutor
----------------------------------------------------------------

                 Key: DIRMINA-533
                 URL: https://issues.apache.org/jira/browse/DIRMINA-533
             Project: MINA
          Issue Type: Bug
          Components: Filter
    Affects Versions: 2.0.0-M1
            Reporter: Trustin Lee
            Assignee: Trustin Lee
             Fix For: 2.0.0-M2


Quoted from the mailing list:

2008-02-20 (수), 20:36 +0900, 이희승 (Trustin Lee) 쓰시길:
> 2008-02-20 (수), 08:23 +0100, Niklas Therning 쓰시길:
> > Wilson Yeung wrote:
> > > After sending a bunch of UDP datagrams, sleep for 30 seconds, then
> > > this gets printed to console:
> > >
> > >      [java] Exception in thread "pool-1-thread-1" 
> > > java.lang.NullPointerException
> > >      [java]       at
> > > org.apache.mina.filter.executor.OrderedThreadPoolExecutor.getSessionBuffer(OrderedThreadPoolExecutor.java:447)
> > >      [java]       at
> > > org.apache.mina.filter.executor.OrderedThreadPoolExecutor.access$900(OrderedThreadPoolExecutor.java:52)
> > >      [java]       at
> > > org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:492)
> > >      [java]       at java.lang.Thread.run(Thread.java:613)
> > >
> > > And then no more messages are ever sent despite how I might try.
> > >
> > > If I modify OrderedThreadPoolExecutor like so:
> > >
> > > clara:executor wilson$ svn diff OrderedThreadPoolExecutor.java
> > > Index: OrderedThreadPoolExecutor.java
> > > ===================================================================
> > > --- OrderedThreadPoolExecutor.java        (revision 627903)
> > > +++ OrderedThreadPoolExecutor.java        (working copy)
> > > @@ -489,7 +489,9 @@
> > >                      }
> > >
> > >                      try {
> > > -                        runTasks(getSessionBuffer(session));
> > > +                       if (session != null) {
> > > +                            runTasks(getSessionBuffer(session));
> > > +                        }
> > >                      } finally {
> > >                          idleWorkers.incrementAndGet();
> > >                      }
> > >
> > > Then all is well.  Any ideas?  Am I abusing Mina, or is it an honest
> > > to goodness Mina bug?
> > >
> > > Wilson
> > >   
> > 
> > Do you have a test case which triggers this problem? You should open up 
> > a JIRA issue and attach your test case and we will have a look at it.
> 
> The stack trace Wilson provided is very weird.  According to the trace,
> it seems like OrderedThreadPoolExecutor.getSessionBuffer() throws a NPE
> because the specified session is null.  The specified session is get
> from IoEvent object.  Now if you look into the IoEvent class, its
> constructor throws NPE if the specified session is null.  This means
> that the session parameter that is passed to
> OrderedThreadPoolExecutor.getSessionBuffer() cannot be null at all.
> 
> So.. any clue? :(

Ugh... my reasoning was wrong.  It's
OrderedThreadPoolExecutor.fetchSession() that returns null, and it's
possible.  Wilson's patch looks reasonable.  Let me fix it soon...

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

Reply via email to