-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[BUG] [Java] retry logic no longer throws HttpServerErrorException #17478
[BUG] [Java] retry logic no longer throws HttpServerErrorException #17478
Comments
I think this is bug. here instead of throwing RestClientException, the original exception should be thrown. |
…eeded in rest template, when the retry limits exceeded rethrow the original exception also add 429 (Too many requests) status code to the retry logic fix OpenAPITools#17478
PR merged. Please give it a try with the latest master or snapshot version when you've time. |
I think your MR to fix this introduced another bug. The code is now (~line 776) if (ex instanceof HttpServerErrorException
|| ((HttpClientErrorException) ex)
.getStatusCode()
.equals(HttpStatus.TOO_MANY_REQUESTS)) {
... then retry the request i.e. if the response is an HttpClientErrorException and it's HttpStatus.TOO_MANY_REQUESTS you retry. I think you are missing a "not" in there - i.e. you don't want to retry TOO_MANY_REQUESTS. (Given this is a SpringBoot template, I probably would have used a |
@GregDThomas do you mind filing a PR with the suggested fix (missing a not)? |
@GregDThomas It was my intention to retry when the status is TOO_MANY_REQUESTS . |
So you're currently retry every server error, and the TOO_MANY_REQUESTS client error? If that's your intent, that's what the code does AFAICT. It just that the behaviour surprised me. Hence my comment. So there's no need for an imminent PR, though I may make some improvements if I ever get around to it in the not near-future. (e.g. using the |
Bug Report Checklist
Description
When upgrading from 7.1.0 to 7.2.0 we are encountering that the change made in #17375 has ensured that the HttpServerException is no longer thrown in generated api clients.
This was used in our code to wrap the error with a better message for the client, while also logging it.
This change has caused that exception to not be thrown, but a RestClientException is thrown instead, which is now unhandled.
was this an intentional change that should be reflected in our codebase, or unintended behaviour?
openapi-generator version
7.2.0, regression from 7.1.0
Generation Details
generator version 7.2.0, installed using the gradle plguin
org.openapitools:openapi-generator-gradle-plugin:7.2.0
generation is done with library = resttemplate.
Steps to reproduce
Using generator version 7.1.0, generate a client using the resttemplate library.
Make an unsuccessful call (500 response) using htis client, while having it wrapped in a try-catch clause for org.springframework.web.client.HttpServerErrorException
This should work, and the catch part should be hit.
Now, upgrade to 7.2.0 and it should not work.
Related issues/PRs
#17375
Suggest a fix
Continue throwing the HttpServerException, or confirm that our use case was incorrect all along.
The text was updated successfully, but these errors were encountered: