Skip to content

socket hang in lambda wiith S3 HeadCommand #7165

@nicolashuby

Description

@nicolashuby

Checkboxes for prior research

Describe the bug

With "@aws-sdk/client-s3": "3.830.0" I have often a socket hangup at the first HEAD Command. There is no fucntionnal impact since the retry works well and genrally the second HEAD Command is successful.
If I downgrade the version to my previous version in production "@aws-sdk/client-s3": "3.777.0" the error is not reprodcutible.
I try several tuning with the S3 Client.
First one :

this.client = new S3Client({
     region: REGION,
     requestHandler: new NodeHttpHandler({
       httpsAgent: new Agent({ keepAlive: true, keepAliveMsecs: 2000, timeout: 10000, maxSockets: 400 }),
       connectionTimeout: 30 * 1000, // 30 seconds
       requestTimeout: 60 * 1000, // 1 minute
     }),

Second one:

this.client = new S3Client({
      region: REGION,
      requestHandler: new NodeHttpHandler({
        httpsAgent: new Agent({ keepAlive: true, keepAliveMsecs: 2000, timeout: 10000, maxSockets: 50 }),
        connectionTimeout: 30 * 1000, // 30 seconds
        requestTimeout: 60 * 1000, // 1 minute
      }),

Here the global runtime configuration

const LAMBDA_RUNTIME = 'nodejs22.x'
const DATADOG_LAYER_ARN = 'arn:aws:lambda:eu-west-3:464622532012:layer:Datadog-Node22-x:124' // See https://github.com/DataDog/datadog-lambda-js/releases
const DATADOG_LAYER_EXTENSION_ARN = 'arn:aws:lambda:eu-west-3:464622532012:layer:Datadog-Extension:77' // See https://github.com/DataDog/datadog-lambda-extension/releases

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

"@aws-sdk/client-s3": "3.830.0"

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node runtime 22

Reproduction Steps

How to reproduce.

  • deploy a lambda with a HEAD Command which is triggered with S3 events
  • Upload several Object in the bucket using the aws console

Observed Behavior

  • The first HEAD Command observe 'socket hangup' error with S3 Service randomly , the second call is always succcessful

Expected Behavior

No 'socket hangup' observed

Possible Solution

I think that my S3 client is not well tuned but I did not fine how to do it.

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.p3This is a minor priority issuepotential-regressionMarking this issue as a potential regression to be checked by team memberresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions