-
Notifications
You must be signed in to change notification settings - Fork 582
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
When client exhausts retry attempts for any API call, it does not make retries for subsequent API calls #4754
Closed
3 tasks done
Comments
trivikr
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
p0
This issue is the highest priority
queued
This issues is on the AWS team's backlog
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
May 24, 2023
trivikr
changed the title
When SDK exhausts retry tokens any API call, it does not make any subsequent retries for other calls
When client exhausts retry attempts any API call, it does not make any retries for subsequent API calls
May 24, 2023
trivikr
changed the title
When client exhausts retry attempts any API call, it does not make any retries for subsequent API calls
When client exhausts retry attempts for any API call, it does not make retries for subsequent API calls
May 24, 2023
One workaround is to use legacy retry strategy import { Kinesis } from "@aws-sdk/client-kinesis"; // >=v3.229.0
import { StandardRetryStrategy } from "@aws-sdk/middleware-retry";
const client = new Kinesis({
region: "us-west-2",
retryStrategy: new StandardRetryStrategy(),
}); Verification code and outputimport { StandardRetryStrategy } from "@aws-sdk/middleware-retry";
// ...
const client = new Kinesis({
region: "us-west-2",
requestHandler: new NodeHttp2HandlerReturnsTimeout(),
retryStrategy: new StandardRetryStrategy(),
});
// ... It's deprecated, but attempts retries for subsequent calls Total: 1 calls, 3 attempts
Total: 2 calls, 6 attempts
Total: 3 calls, 9 attempts
Total: 4 calls, 12 attempts
Total: 5 calls, 15 attempts
Total: 6 calls, 18 attempts
// ... and so on. |
It's not recommended, but alternatively, you can also downgrade your client to <3.229.0. import { Kinesis } from "@aws-sdk/client-kinesis"; // v3.226.0
const client = new Kinesis({ region: "us-west-2" }); Verification code and outputimport { Kinesis } from "@aws-sdk/client-kinesis"; // v3.226.0
import { NodeHttp2Handler } from "@aws-sdk/node-http-handler";
// Simlulate a timeout error.
class NodeHttp2HandlerReturnsTimeout extends NodeHttp2Handler {
async handle(request, options) {
const timeoutError = new Error("Request timed out");
timeoutError.name = "TimeoutError";
throw timeoutError;
}
}
const client = new Kinesis({
region: "us-west-2",
requestHandler: new NodeHttp2HandlerReturnsTimeout(),
});
let calls = 0;
let attempts = 0;
while (true) {
try {
await client.listStreams({});
} catch (error) {
const currentCallAttempts = error.$metadata.attempts;
calls += 1;
attempts += currentCallAttempts;
console.log(`Total: ${calls} calls, ${attempts} attempts`);
if (error.$metadata.attempts === 1) {
// No more retries can be made.
break;
}
}
} Total: 1 calls, 3 attempts
Total: 2 calls, 6 attempts
Total: 3 calls, 9 attempts
Total: 4 calls, 12 attempts
Total: 5 calls, 15 attempts
// ... |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Checkboxes for prior research
Describe the bug
When client exhausts retry attempts for any API call, it does not make retries for subsequent API calls
SDK version number
All>=v3.229.0
, used v3.335.0 in testingWhich JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
All, used v16.20.0 in testing
Reproduction Steps
Here is a repro which adds custom Handler which returns a Timeout for every call, and a retryStrategy with just 100ms delay between retries.
To log attempts, the console.log was added in
node_modules/@aws-sdk/util-retry/dist-cjs/StandardRetryStrategy.js
Observed Behavior
When the
listStreams
API call is made the second time, the previous value of attempts, i.e2
is used, and no retries are made.Expected Behavior
The API calls are repeatedly made till retry tokens are actually exhausted.
Possible Solution
Needs deep dive, but it looks like StandardRetryStrategy should return new retryToken when acquire is called.
Additional Information/Context
This issue was discovered while working on #4753
The text was updated successfully, but these errors were encountered: