hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Speirs <bill.spe...@gmail.com>
Subject Too Many Open Files Exception
Date Mon, 31 Oct 2011 19:26:21 GMT
I'm having an issue with the NIO Reactor. I'm getting the following exception:

org.apache.http.nio.reactor.IOReactorException: Failure accepting connection
        at org.apache.http.impl.nio.reactor.DefaultListeningIOReactor.processEvent(DefaultListeningIOReactor.java:169)
        at org.apache.http.impl.nio.reactor.DefaultListeningIOReactor.processEvents(DefaultListeningIOReactor.java:149)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:370)
        at my code where I call execute()
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Too many open files
        at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:152)
        at org.apache.http.impl.nio.reactor.DefaultListeningIOReactor.processEvent(DefaultListeningIOReactor.java:165)
        ... 4 more

This code does some complex things including opening two connection
(via HTTP Client) to other services. I believe that I'm correctly
cleaning up those connections by getting the entity in the response to
both, and calling close on the stream.

// first connection to another service
InputStream is = response.getEntity().getContent();

// do stuff with is


// second connection to another service

HttpEntity entity = response.getEntity();
if(entity != null) {
     // close this to release the connection

That is all I need to do, correct? There isn't anything else to
release the socket is there?



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

View raw message