Closed iconara closed 2 weeks ago
I'm no longer sure whether this is an issue with the AWS SDK or with the timeout library that we use. I'll close this until I've figured it out.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Describe the bug
We are debugging an issue where code that uses Guava's SimpleTimeLimiter doesn't work properly when a process times out and as part of its cleanup closes an AWS SDK client that uses Netty as the HTTP implementation.
The reason seems to be that the
AwaitCloseChannelPoolMap#close
implementation catchesInterruptedException
and wraps it inRuntimeException
, hiding it from the calling code. This happens here: https://github.com/aws/aws-sdk-java-v2/blob/88abec27e7d5d35b21545c7e05875a7cc3d0f46e/http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/AwaitCloseChannelPoolMap.java#L174-L175Regression Issue
Expected Behavior
When a thread is interrupted it should either re-throw the
InterruptedException
or mark the thread as interrupted withThread.currentThread().interrupt()
, but not both mark the thread as interrupted and throw an exception. Throwing an generic exception means that other code that expects to either get interrupted, or to handleInterruptedException
to do cleanup instead sees an exception they don't understand.Current Behavior
The thread marks the thread as interrupted and throws a generic
RuntimeException
.Reproduction Steps
I'm not able to reproduce it in isolation, but here is a stack trace showing how an
InterruptedException
fromCompletableFuture#get
is wrapped as aRuntimeException
byAwaitCloseChannelPoolMap#close
:Possible Solution
Either call
Thread.currentThread().interrupt()
and don't throw an exception, or re-throw theInterruptedException
(this would however require addingInterruptedException
to the method signature).Additional Information/Context
No response
AWS Java SDK version used
2.27.21
JDK version used
Multiple
Operating System and version
Multiple