mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Issues with the NioProcessor
Date Wed, 27 Jul 2011 21:43:23 GMT
Hi guys,

today, I had to fought with the NioProcessor executor, while doing a 
test with a connector.

I ran a test where I opened and closed 100 000 connections. The chain 
was pretty simple, and I used the default configuration.

At some point, I got some exceptions :
java.util.concurrent.RejectedExecutionException
     at 
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768)
     at 
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
     at 
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658)
     at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.startupProcessor(AbstractPollingIoProcessor.java:463)
     at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.remove(AbstractPollingIoProcessor.java:417)
     at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.remove(AbstractPollingIoProcessor.java:1)
     at 
org.apache.mina.core.service.SimpleIoProcessorPool.remove(SimpleIoProcessorPool.java:253)
     at 
org.apache.mina.core.service.SimpleIoProcessorPool.remove(SimpleIoProcessorPool.java:1)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.filterClose(DefaultIoFilterChain.java:634)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:525)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$8(DefaultIoFilterChain.java:521)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:813)
     at 
org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:143)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:525)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$8(DefaultIoFilterChain.java:521)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:813)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterClose(DefaultIoFilterChain.java:740)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:525)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:518)
     at 
org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:306)
     at 
org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:288)
     at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.unBind(LdapNetworkConnection.java:1777)[21:20:09]

WARN [org.apache.directory.ldap.client.api.LdapNetworkConnection] -
java.util.concurrent.RejectedExecutionException
     at 
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768)
     at 
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
     at 
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658)
     at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.startupProcessor(AbstractPollingIoProcessor.java:463)
     at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.remove(AbstractPollingIoProcessor.java:417)
     at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.remove(AbstractPollingIoProcessor.java:1)
     at 
org.apache.mina.core.service.SimpleIoProcessorPool.remove(SimpleIoProcessorPool.java:253)
     at 
org.apache.mina.core.service.SimpleIoProcessorPool.remove(SimpleIoProcessorPool.java:1)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.filterClose(DefaultIoFilterChain.java:634)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:525)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$8(DefaultIoFilterChain.java:521)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:813)
     at 
org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:143)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:525)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$8(DefaultIoFilterChain.java:521)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:813)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterClose(DefaultIoFilterChain.java:740)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:525)
     at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:518)
     at 
org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:306)
     at 
org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:288)
     at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.unBind(LdapNetworkConnection.java:1777)
     at org.i2l.samples.LdapTestCase.main(LdapTestCase.java:22)

I fixed that by adding a RejectExecutionHandler in the 
ThreadPoolExecutor created in SimpleIoProcessorPool :

     public SimpleIoProcessorPool(Class<? extends IoProcessor<S>> 
processorType,
             Executor executor, int size) {
        ...
             if (createdExecutor) {
                 this.executor = Executors.newCachedThreadPool();

                 // Set a default reject handler
                 
((ThreadPoolExecutor)this.executor).setRejectedExecutionHandler( new 
ThreadPoolExecutor.CallerRunsPolicy() );
             } else {
                 this.executor = executor;
             }

I suggest we add this handler in MINA, when using the default configuration.

Thoughts ?

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com


Mime
View raw message