hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rossen Stoyanchev <rstoyanc...@vmware.com>
Subject Re: Concurrent asynchronous HTTP exchanges
Date Tue, 26 Jun 2012 15:21:26 GMT

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

----- Original Message -----
> From: "Oleg Kalnichevski" <olegk@apache.org>
> To: "HttpClient User Discussion" <httpclient-users@hc.apache.org>
> 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: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message