aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

TimeoutError is not retried

Open cecheta-lego opened this issue 3 years ago • 1 comments

Checkboxes for prior research

Describe the bug

We are experiencing intermittent TimeoutError errors when using the SDK, particularly the ListRulesCommand in EventBridge.

Error: AWS SDK error wrapper for TimeoutError: socket hang up
    at asSdkError (/home/runner/work/project/project/node_modules/.pnpm/@[email protected]/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:88:12)
    at StandardRetryStrategy.retry (/home/runner/work/project/project/node_modules/.pnpm/@[email protected]/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:61:29)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /home/runner/work/project/project/node_modules/.pnpm/@[email protected]/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
    at func (/home/runner/work/project/project/test.ts:174:13)
    at Object.<anonymous> (/home/runner/work/project/project/test.ts:315:7) {
    '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

According to the service-error-classification, we would expect TimeoutError to be included as a transient error code, and therefore automatically retried, however this does not occur. By logging the error above, we see that there was only one attempt.

SDK version number

@aws-sdk/[email protected] @[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

16.16.0

Reproduction Steps

The error occurs intermittently when running integration tests in a workflow, however it always occurs on the same API call in the same test.

const client = new EventBridgeClient({
  region: "eu-central-1",
});

await client.send(
  new ListRulesCommand({
    EventBusName: "event-bus",
    NamePrefix: "rule",
  })
);

Observed Behavior

Error: AWS SDK error wrapper for TimeoutError: socket hang up
    at asSdkError (/home/runner/work/project/project/node_modules/.pnpm/@[email protected]/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:88:12)
    at StandardRetryStrategy.retry (/home/runner/work/project/project/node_modules/.pnpm/@[email protected]/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:61:29)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /home/runner/work/project/project/node_modules/.pnpm/@[email protected]/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
    at func (/home/runner/work/project/project/test.ts:174:13)
    at Object.<anonymous> (/home/runner/work/project/project/test.ts:315:7) {
    '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

Expected Behavior

The API call would retry by itself and then succeed.

Possible Solution

No response

Additional Information/Context

No response

cecheta-lego avatar Aug 10 '22 15:08 cecheta-lego

This seems to be an issue caused by using jest

https://github.com/facebook/jest/issues/2549

I am guessing that all these checks fail, therefore a new Error object is created

https://github.com/aws/aws-sdk-js-v3/blob/fcb4ba102eafbc847048c9b83d99ac9733fe620e/packages/middleware-retry/src/StandardRetryStrategy.ts#L120

ghost avatar Aug 11 '22 06:08 ghost

Hi @cecheta-lego, thanks for opening this issue. This issue seems to be similar to this one, where I have asked for more details to reproduce the error. In that related issue I see there are 3 retries, so, could you update to the latest version and see if the error is retried there?

Thanks!

yenfryherrerafeliz avatar Dec 09 '22 23:12 yenfryherrerafeliz

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

github-actions[bot] avatar Dec 17 '22 00:12 github-actions[bot]

Hello @yenfryherrerafeliz,

This error occurs intermittently when we run tests in a GitHub Actions workflow. We are using v3.215.0. When the error occurred, there were no retries, most likely due to this comment https://github.com/aws/aws-sdk-js-v3/issues/3851#issuecomment-1211618132.

I no longer have access to the codebase so I will be unable to reproduce this again or update to the latest version.

ghost avatar Dec 19 '22 01:12 ghost

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.

github-actions[bot] avatar Jul 13 '23 00:07 github-actions[bot]