On Tue, 2012-06-26 at 08:21 -0700, Rossen Stoyanchev wrote:
> Yes, it does look like a JDK issue. I was using Sun/Oracle Java 1.6.0_32-ea 
> (Ubuntu). Switching to 1.7 gives a different, more understandable error:
> 
> Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
>       at sun.nio.ch.SocketDispatcher.preClose(SocketDispatcher.java:59)
>       at 
> sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(SocketChannelImpl.java:819)
>       at 
> java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:228)
>       at 
> java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:115)
>       at 
> org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.doShutdown(AbstractMultiworkerIOReactor.java:439)
>         ...
> Caused by: java.io.IOException: Too many open files
>       at sun.nio.ch.FileDispatcherImpl.init(Native Method)
>       at sun.nio.ch.FileDispatcherImpl.<clinit>(FileDispatcherImpl.java:35)
> 
> So it looks like too it was too many socket connections. 
> 
> Thanks again for your help,
> Rossen
> 

Rossen

As far as I know this limit can be increased if necessary. HttpCore, the
low level HTTP transport library HttpAsyncClient is based on, is known
to be able to handle a deal more than 4000 concurrent connections.

Oleg 


> ----- Original Message -----
> > From: "Oleg Kalnichevski" <[email protected]>
> > To: "HttpClient User Discussion" <[email protected]>
> > Sent: Monday, June 25, 2012 3:37:18 PM
> > Subject: Re: Concurrent asynchronous HTTP exchanges
> > 
> > On Mon, 2012-06-25 at 09:51 -0700, Rossen Stoyanchev wrote:
> > > Thanks for your response, Oleg!
> > > 
> > > Setting defaultMaxPerRoute and maxTotal on the
> > > PoolingClientAsyncConnectionManager allowed me to create a large
> > > number of concurrent requests. Up to about 4000 it runs well.
> > > Going to 5000 (I was trying to get to 10,000 to see where the
> > > boundaries are) results in the following exception:
> > > 
> > > Exception in thread "I/O dispatcher 2"
> > > java.lang.NoClassDefFoundError: Could not initialize class
> > > sun.nio.ch.FileDispatcher
> > >   at sun.nio.ch.SocketDispatcher.preClose(SocketDispatcher.java:41)
> > >   at
> > >   
> > > sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(SocketChannelImpl.java:709)
> > >   at
> > >   
> > > java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:201)
> > >   at
> > >   
> > > java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:97)
> > >   at
> > >   
> > > org.apache.http.impl.nio.reactor.IOSessionImpl.close(IOSessionImpl.java:215)
> > >   at
> > >   
> > > org.apache.http.impl.nio.reactor.AbstractIOReactor.closeActiveChannels(AbstractIOReactor.java:544)
> > >   at
> > >   
> > > org.apache.http.impl.nio.reactor.AbstractIOReactor.hardShutdown(AbstractIOReactor.java:579)
> > >   at
> > >   
> > > org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:309)
> > >   at
> > >   
> > > org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
> > >   at
> > >   
> > > org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:601)
> > >   at java.lang.Thread.run(Thread.java:662)
> > > 
> > > Are there any other settings to consider when processing a large
> > > number of concurrent requests? The specific scenario I'm testing
> > > with is reading JSON responses (about 2K each) where each response
> > > takes about a second to complete (i.e. the test server holds for a
> > > second before returning).
> > > 
> > > Thanks,
> > > Rossen
> > > 
> > 
> > 
> > Generally java.lang.NoClassDefFoundError indicates a classpath /
> > application configuration / deployment problem. So, this really does
> > not
> > look like an issue with HttpAsyncClient.
> > 
> > The error appears to be caused by some internal error in the JRE NIO
> > implementation code. You might want to try upgrading / downgrading
> > your
> > JRE to a more stable version.
> > 
> > Oleg
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to