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

Set maxAttempts to 10 to workaround slower container startup #11

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

danmactough
Copy link
Owner

@danmactough danmactough commented Nov 19, 2024

Since switching to aws-sdk-v3, we're seeing a lot of random errors like:

  console.error
    Error: AWS SDK error wrapper for TimeoutError: socket hang up
        at asSdkError (/Users/daniel.mactough/code/partner-service/node_modules/@smithy/middleware-retry/dist-cjs/index.js:103:10)
        at /Users/daniel.mactough/code/partner-service/node_modules/@smithy/middleware-retry/dist-cjs/index.js:327:21
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
        at /Users/daniel.mactough/code/partner-service/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:34:22
        at deleteTable (/Users/daniel.mactough/code/partner-service/node_modules/jest-dynamodb-local-docker/lib/table-helpers.js:69:3)
        at Object.<anonymous> (/Users/daniel.mactough/code/partner-service/test/lib/task-store.test.js:69:5) {
      '$metadata': { attempts: 3, totalRetryDelay: 25 }
    }

 FAIL  test/lib/task-store.test.js
  ● Task Store › createTask › creates a task

    AWS SDK error wrapper for TimeoutError: socket hang up

I thought this was a manifestation of jestjs/jest#2549 impacting the handling of retry errors due to the pervasive use of instanceof checks in aws-sdk-v3 similar to aws/aws-sdk-js-v3#3851. I also thought this might be related to jest fake timers interfering with aws-sdk-v3 connection timers. Eventually, I tried just increasing the number of retries and that seems to have resolved the errors. It doesn't seem worthwhile to try to find the "sweet spot" on this configuration parameter -- I imagine something less than 10 attempts would be sufficient -- but I'd rather this Just Work™ (which the value of 10 seems to do).

@danmactough danmactough added the bug Something isn't working label Nov 19, 2024
@danmactough danmactough merged commit 704b8ab into main Nov 19, 2024
@danmactough danmactough deleted the add-max-attempts branch November 19, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant