Skip to content
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

Please check usage of ResourceAccessException vs. RestClientException wrapping IOException in DefaultRestClient #33464

Open
helmut-hackl-dynatrace opened this issue Sep 2, 2024 · 1 comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@helmut-hackl-dynatrace
Copy link

Affects: spring web 6.1.11

it's not really clear when a ResourceAccessException (wrapping an IOException) or its base class RestClientException (which can also wrap an IOException) is thrown in org.springframework.web.client.DefaultRestClient.

eg.
when calling responseWrapper.hasEmptyMessageBody() in readWithMessageConverters and the getBody() call to an underlying ReactorNettyClientResponse does timeout (wrapped into an IOException) - i would expect a ResourceAccessException.

 /**
 * Exception thrown when an I/O error occurs.
 *
 * @author Arjen Poutsma
 * @since 3.0
 */
public class ResourceAccessException extends RestClientException {

from stacktrace:

2024-09-02 03:46:34.003 UTC WARN [svm25641,dynatrace.launcher] [qtp242113956-122375] ClusterAppManifestsFetcherImpl: Cannot fetch app icon from cluster endpoint https://svm25641.apps.internal.dynatrace.com/platform-internal/cluster-internal/manifest/dynatrace.classic.databases/icon
org.springframework.web.client.RestClientException: Error while extracting response for type [org.springframework.core.io.Resource] and content type [image/png]
	at org.springframework.web.client.DefaultRestClient.readWithMessageConverters(DefaultRestClient.java:240)
	at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.readBody(DefaultRestClient.java:685)
	at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.toEntityInternal(DefaultRestClient.java:655)
	at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.toEntity(DefaultRestClient.java:644)
Caused by: java.io.IOException: null
	at org.springframework.http.client.ReactorNettyClientRequest.convertException(ReactorNettyClientRequest.java:143)
	at org.springframework.http.client.ReactorNettyClientResponse.getBody(ReactorNettyClientResponse.java:87)
	at org.springframework.web.client.DefaultRestClient$DefaultConvertibleClientHttpResponse.getBody(DefaultRestClient.java:748)
	at org.springframework.web.client.IntrospectingClientHttpResponse.hasEmptyMessageBody(IntrospectingClientHttpResponse.java:83)
	at org.springframework.web.client.DefaultRestClient.readWithMessageConverters(DefaultRestClient.java:203)
	... 176 common frames omitted
Caused by: io.netty.handler.timeout.ReadTimeoutException: null
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 2, 2024
@bclozel bclozel added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Sep 2, 2024
@rstoyanchev
Copy link
Contributor

I think ResourceAccessException is about early I/O issues that result from request execution, and that does not include I/O errors from handling the response.

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

4 participants