Skip to content

IOExceptionFilters not Invoked on ConnectException #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jlook7 opened this issue Nov 27, 2013 · 4 comments
Open

IOExceptionFilters not Invoked on ConnectException #426

jlook7 opened this issue Nov 27, 2013 · 4 comments

Comments

@jlook7
Copy link

jlook7 commented Nov 27, 2013

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.

@slandelle
Copy link
Contributor

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

Contributions welcome.

@amirhmd
Copy link

amirhmd commented Feb 6, 2017

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?

@tsteff
Copy link

tsteff commented Feb 7, 2017

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.

@slandelle
Copy link
Contributor

@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!" :)

cs-workco pushed a commit to cs-workco/async-http-client that referenced this issue Apr 13, 2023
…syncHttpClient#426)

### Motivation

If we call 
```
context.write(ByteBuffer(string: "foo"), promise: nil)
context.flush()
context.close()
```
there is no guarantee that `"foo"` will be written to the network. Currently the test `testNoBytesSentOverBodyLimit` assumes this however.

### Changes

- `testNoBytesSentOverBodyLimit` does not assume anymore, that bytes will be sent before a close of the connection.
- Use `XCTAssertEqual` to compare `Equatable` errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants