-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Either RESTEasy Reactive/REST Client Reactive swallow errors in some scenarios, very difficult to debug #19488
Comments
The solution to making the actual ENDPOINT work? @Singleton
class MyObjectMapperCustomizer implements ObjectMapperCustomizer {
public void customize(ObjectMapper mapper) {
mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
}
} I blame Jackson for the terrible error message, for starters... 😅 EDIT: Disregard everything I said above. I'm an idiot, the API doesn't even return an array of objects. And my comment about:
Being a terrible error for saying |
Yeah, it's sometimes hard to understand where the Jackson errors actually mean in practice. |
@geoand The main issue here was that the error mistakenly (I think) seemed to be "swallowed" -- no RESTeasy exception is ever thrown and it fails to "bubble up": In the below image, No exception/error message -- the rest of the function just fails to execute And the page response, empty, not the Quarkus exception page: |
Do you have a simple GH repo that reproduces the logging issue? I could setup a new project and copy paste the classes above but a reproduce repo would make things a lot easier (It's not uncommon with these copy/paste reproducers for something to be missing so you spend the time setting it up and then it does not work anyway). |
As Stuart mentions, if you have a small project we can use to reproduce what you are seeing, that would be great |
Yeah absolutely, I should have provided it in the first place. I will feel quite an ass if it's user-error, but I will immediately put together a reproduction, that's no issue (it was a teaching app for showing Quarkus to a CS student anyways using OpenWeather API I wrote -- it's tiny and has 2 files.) Will try to revert it back to the state that broke it and then post it here as a zip. |
Here you go @geoand @stuartwdouglas: quarkus-reactive-jackson-repro.zip It runs on port For example, and watch the log output Important pieces of the code (only 2 areas) have been tagged with // FOR QUARKUS DEVS
@GET
@Path("/broken")
@Produces(MediaType.APPLICATION_JSON)
@Blocking
public Set<WeatherResponse> thisBreaksStuffs(@QueryParam("city") String city) {
log.info("HERE, START OF thisBreaksStuffs()");
Set<WeatherResponse> res = weatherApi.INCORRECT_BROKEN_GetWeatherByCityAndCountry(
city, "USA",
config.openWeatherMapApiKey, WeatherService.MeasurementKind.imperial
);
log.info("AFTER weatherApi.INCORRECT_BROKEN_GetWeatherByCityAndCountry, RETURNING RESPONSE");
return res;
} |
If a call fails on the server it should be treated as an internal server error, it should not be propagating the response back to the original request. Fixes quarkusio#19488
This is because the 400 WebApplicationException from the client ends up being interpreted by the server. It's a known issue with both the client and the server using the same exception types, I have added a fix. |
Thank you, I really appreciate you all 🙏 |
If a call fails on the server it should be treated as an internal server error, it should not be propagating the response back to the original request. Fixes quarkusio#19488 (cherry picked from commit 6674bd5)
Essentially the fact that ClientTracingFilter was using a static field for TextMapPropagator was causing GraalVM to initialize the entire telemetry infrastructure at build time Fixes: quarkusio#19488
Hi, I just came across the same issue in 2.16.3: if the REST client gets a 400 while serving a request, the application returns a 400 (while I think it should return a 500). I created a reproducer here: https://github.com/lorenzobenvenuti/rest-client-exception-bug Thanks, lorenzo |
@lorenzobenvenuti the behavior you mention is expected. If you really want to return 400 when the client gets that result, you can use |
Hi @geoand , actually the problem is that I don't want to return a 400: returning the same status code of a REST call performed by the request handler seems misleading to me. Since the underlying issue is that there was an unhandled exception on the server side, I think the default behavior should be returning a 500 (BTW this seems the same issue addressed by this MR, but either it doesn't work or there was a regression) |
Oh sorry, I misread what you wrote. Please open a new issue and add the details you mentioned in the comment above. Thanks |
Created #31326. Thanks! |
Describe the bug
The actual error being throw under the hood was:
But between the fact that Quarkus generates a lot of code, and the reactive/multithreaded bit, debugging this and trying to navigate the source + callstack was somewhat of a nightmare because:
But with this code/endpoint:
Nothing is ever logged past the initial
called!!!
🙁Very confusing
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
Quarkus
v2.1.2-final
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: