-
Notifications
You must be signed in to change notification settings - Fork 94
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
Non-idempotent read timeouts are retried #897
Comments
I believe there are also other times when any request can be safely retried. The important property is that the remote service did not and will not do any work for that request. For example, if the remote service responds with a 503, it certainly received the request, but also certainly did no work for it (assuming it uses the response code correctly), so it's safe to retry that. |
square/okhttp#3318 is closed and as @swankjesse pointed out, there may be issues with proxies, QUIC and other things that are hard to be sure |
If you can't tell whether or not the server has received the request, then the correct thing to do is to not retry. Retrying a non-idempotent request is an optimization for the special case that you do know for a fact it's safe to do. If you can't tell you're in the special case, don't try to optimize. |
This issue has been automatically marked as stale because it has not been touched in the last 60 days. Please comment if you'd like to keep it open, otherwise it'll be closed in 7 days time. |
What happened?
A non-idempotent HTTP request was retried when the original request failed due to a read timeout.
The retried request succeeded. However the original request also eventually succeeded. This left the service in an incorrect state because an action that should have only been attempted once was performed twice.
What did you want to happen?
Requests should only be retried if either:
Differentiating between connect timeouts and read timeouts is currently an open issue in OkHttp:
square/okhttp#3318
Until that issue is resolved, we should bias towards the more limiting, but safe behavior of not retrying non-idempotent requests.
The text was updated successfully, but these errors were encountered: