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

I/O Error Attempted read from closed stream. #121

Closed
mjeanroy opened this issue Dec 2, 2020 · 0 comments
Closed

I/O Error Attempted read from closed stream. #121

mjeanroy opened this issue Dec 2, 2020 · 0 comments

Comments

@mjeanroy
Copy link

mjeanroy commented Dec 2, 2020

Hi,

I tried to use the org.springframework.social.google.api.Google to fetch user information but in case Google respond a status code in error (say 503 in my case), I get an error "I/O Error Attempted read from closed stream.".
This is due to an error handler that tries to log response body, as you can see here.

Then, spring RestTemplate tries to read the response body again to check if the response body is empty or not, then an I/O Error occurs since the response body can be consumed only once.

Note that I use Apache Http Component, not sure if the problem occurs with OkHTTP or other HTTP Client implementation.

A workaround is to use ERROR level for the given logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant