-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
IOExceptions can cause infinite retries over HTTP/2 #3268
Comments
I’d like to somehow differentiate exceptions thrown by OkHttp from exceptions thrown by interceptors and use that to enable the retry. |
I face the same problem now,404 also cause IOException which will cause infinite retries, i don't think it should retry infinitely in this situation. This bug only occurred when protocol is http2. |
Hello, I think I have a potential solution to this issue. Would it be best to discuss here or should I just submit a pull request? Thanks in advance. I am thinking of making the following change in okhttp/src/main/java/okhttp3/internal/http/RetryAndFollowupInterceptor.java
|
@mdsiebler +1 to PR even if discussion continues here, would help show which other tests break (if any) |
Is my problem is some reason? I |
@swankjesse @yschimke we met this issue too. Has it been fixed? Or any suggested temporary walk around? |
Will implement with this: |
@swankjesse The issue linked in your last comment for this fix to be implemented with is the same issue number as this issue. Is there a different issue/PR resolving this one? |
Whoops! Will implement with this: |
Stick the following test into
HttpOverHttp2Test
(which I did since it's hard to get tests to do HTTP2 otherwise):The test will never finish execution due to infinite retries.
The infinite retry happens in
RetryAndFollowUpInterceptor
. It constantly thinks it's got a recoverable error so it never quits.As far as I can tell, the issue lies in
StreamAllocation.streamFailed()
. Without HTTP2 it setsroute = null
, which means that when you retry the request, you eventually run out of routes to try. OnceStreamAllocation.hasMoreRoutes()
returns false, the request is done.However, with HTTP2 this never gets set to null, thus it always thinks it has more routes. As a result, an
IOException
can cause infinite retries.The text was updated successfully, but these errors were encountered: