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

HttpBackOffIOExceptionHandler and HttpBackOffUnsuccessfulResponseHandler do not restore the interrupted status after catching InterruptionException #1005

Closed
micheldavid opened this issue Mar 20, 2020 · 0 comments · Fixed by #1006
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@micheldavid
Copy link
Contributor

I found this by accident while looking at a different unexpected behavior within my system.

While handling IOException, the HttpBackOffIOExceptionHandler does not rethrow an exception and also does not reset the thread interrupted bit after catching InterruptedException.

See article with explanation: https://dzone.com/articles/why-do-we-need-threadcurrentthreadinterrupt-in-int

Environment details

  1. Specify the API: GCS objects list
  2. OS type and version: Debian
  3. Java version: Java 8
  4. google-http-client version(s): 1.34.2
micheldavid pushed a commit to micheldavid/google-http-java-client that referenced this issue Mar 20, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Mar 20, 2020
@chingor13 chingor13 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 25, 2020
@yoshi-automation yoshi-automation removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Mar 25, 2020
micheldavid pushed a commit to micheldavid/google-http-java-client that referenced this issue Jun 18, 2020
@micheldavid micheldavid changed the title HttpBackOffIOExceptionHandler does not reset the interrupt bit after catching InterruptionException HttpBackOffIOExceptionHandler and HttpBackOffUnsuccessfulResponseHandler do not restore the interrupted status after catching InterruptionException Jun 18, 2020
chingor13 pushed a commit that referenced this issue Jun 19, 2020
…edException (#1005) (#1006)

* fix: reset the thread's interrupt bit after catching InterruptedException (#1005)

* - Updated code comment to:
Mark thread as interrupted since we cannot throw InterruptedException here.

- Also setting thread interrupted in
HttpBackOffUnsuccessfulResponseHandler.

- Added tests for both HttpBackOffIOExceptionHandler and
HttpBackOffUnsuccessfulResponseHandler.

* Fix bad merge

* formatted files with "mvn clean com.coveo:fmt-maven-plugin:format"

Co-authored-by: Mike DaCosta <mikedacosta@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
3 participants