Interesting. I'm running this on OSX and I can hit other hosts where this problem doesn't manifest. The latency between the two endpoints are pretty close, both <50ms. Is there anything with respect to client configuration that could exasperate these errors?
On Fri, Nov 2, 2012 at 4:26 PM, sebb <[email protected]> wrote: > On 2 November 2012 19:58, Mark Greene <[email protected]> wrote: > > I'm running into an issue where after making about 20k requests to a > single > > host (200 concurrently) I start seeing these exceptions' > > > > java.net.BindException: Address already in use > >> > >> at sun.nio.ch.Net.connect(Native Method) > >> > >> at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:532) > >> > >> at > >> > org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:275) > >> > >> at > >> > org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:140) > >> > >> at > >> > org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:374) > >> > >> at > >> > org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.execute(PoolingClientAsyncConnectionManager.java:108) > >> > >> at > >> > org.apache.http.impl.nio.client.AbstractHttpAsyncClient.doExecute(AbstractHttpAsyncClient.java:464) > >> > >> at > >> > org.apache.http.impl.nio.client.AbstractHttpAsyncClient.access$000(AbstractHttpAsyncClient.java:101) > >> > >> at > >> > org.apache.http.impl.nio.client.AbstractHttpAsyncClient$1.run(AbstractHttpAsyncClient.java:485) > >> > > > > Is this a form of back pressure? What can I do to avoid these types of > > errors? > > The message can be misleading - I've seen this on Windows JVMs when > the host runs out of sockets or file handles. > > As TCP sockets need to be kept for a while (TIME_WAIT) after > disconnection (to pick up any stray incoming packets) the host will > need more sockets that the total number of current connections. When > the wait time expires, the socket will be released for further use. > > The TIME_WAIT cannot be avoided (it's part of TCP), but you may be > able to configure more sockets, or re-use connections more > efficiently, or slow down the connnection rate to give more time for > the cleanup to occur. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
