Async Request Cancellation in DynamoDB SDK v2 Does Not Abort In-Flight HTTP Calls
0 reputation · 12 Aug 2022, 06:25 UTC
0 reputation · 12 Aug 2022, 06:25 UTC
When using the asynchronous DynamoDB client in AWS SDK v2, developers can cancel a CompletableFuture returned by operations like scan() or query(). However, this cancellation does not translate to aborting the underlying HTTP request sent to DynamoDB. The Netty-based HTTP client continues processing the request until completion, consuming read capacity and generating response data that is ultimately discarded.
This behavior has operational implications for applications that rely on cancellation for resource management or user-initiated request termination. Connection pool exhaustion can occur if many requests are cancelled without actual network-level abort, and billing for consumed capacity continues regardless of client-side cancellation.
The SDK provides apiCallTimeout and apiCallAttemptTimeout in ClientOverrideConfiguration to enforce client-side timeouts, but these mechanisms do not provide a way to cancel the underlying HTTP request either. DynamoDB has no server-side API to cancel an in-flight request, and the SDK does not currently propagate cancellation signals to the Netty channel.
CompletableFuture, or is this behavior by design?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.