async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

IOExceptionFilters not Invoked on ConnectException

Open jlook7 opened this issue 12 years ago • 4 comments

It appears that if a server is down, the IOExceptionFilter does nothing to attempt reconnecting to the server. I also have also set request retries to Integer.MAX_VALUE.

2013-11-26 18:42:24,011 [New I/O boss #17] DEBUG NettyAsyncHttpProvider Unexpected I/O exception on channel [id: 0xc09e06ee] java.net.ConnectException: Connection refused: stunspun.corp.gq1.yahoo.com/10.88.182.226:4080 at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:735) at org.jboss.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150) at org.jboss.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105) at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

Ideally, there would be a feature to enable exponential backoff on disconnects to maintain a connection between the client and server.

jlook7 avatar Nov 27 '13 02:11 jlook7

Reconnection is dealt with the retry mechanism, but there's no exponential backoff.

Contributions welcome.

slandelle avatar Jul 15 '14 11:07 slandelle

hi there Im new to open source and would love to contribute to AsyncHttpClient. Can anyone help me get started? Or is AsyncHttpClient for people who are more experienced in open source?

amirhmd avatar Feb 06 '17 16:02 amirhmd

Shouldn't this be a defect? the point of the filter is to be triggered on IOException. I was hoping to use the IOExceptionFilter for closing and submitting spans for distributed tracing if using this client.

tsteff avatar Feb 07 '17 17:02 tsteff

@amirhmd Best way is to dig into the code, get familiar with it, and get a stab at fixing an issue, possibly one you hit. I can help with Pull Request review.

@tsteff Well, IOExceptionFilter currently deals with Exceptions that happens once the socket is connected. Labelling something that wasn't implemented as an issue or as a missing feature is a matter of point of view. Anyway, I personally don't use those filters (I use the handler of the future), so I won't take a stab at it. But I can sure review Pull Requests. As the label says: "Contributions Welcome!" :)

slandelle avatar Feb 07 '17 18:02 slandelle