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

fix(node-http-handler): undeprecate connectionTimeout #4669

Merged
merged 1 commit into from Apr 26, 2023

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Apr 26, 2023

Issue

Fixes: #4668

Description

Undeprecates connectionTimeout, and destroys the request if it's timed out before before socket is available.

Testing

Using repro code:

import { S3 } from "../aws-sdk-js-v3/clients/client-s3/dist-cjs/index.js";
import { NodeHttpHandler } from "../aws-sdk-js-v3/packages/node-http-handler/dist-cjs/index.js";

const client = new S3({
  requestHandler: new NodeHttpHandler({
    // For repro this value should be between time taken for socket assigned, and time taken by request.
    connectionTimeout: 40,
  }),
});

await client.listBuckets({});

Before

The request incorrectly times out, as it assigns connectionTimeout in requestTimeout.

/local/home/trivikr/workspace/aws-sdk-js-v3/packages/node-http-handler/dist-cjs/node-http-handler.js:91
                reject(Object.assign(new Error(`Connection timed out after ${timeout} ms`), { name: "TimeoutError" }));
                                     ^

Error [TimeoutError]: Connection timed out after 40 ms
    at ClientRequest.<anonymous> (/local/home/trivikr/workspace/aws-sdk-js-v3/packages/node-http-handler/dist-cjs/node-http-handler.js:91:38)
    at Object.onceWrapper (node:events:627:28)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.emitRequestTimeout (node:_http_client:839:9)
    at Object.onceWrapper (node:events:627:28)
    at TLSSocket.emit (node:events:525:35)
    at TLSSocket.Socket._onTimeout (node:net:550:8)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7) {
  '$metadata': { attempts: 4, totalRetryDelay: 255 }
}

After

No error, as the request goes through as the connectionTimeout value is greater than the time required for connection to happen.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr requested review from a team as code owners April 26, 2023 19:42
@trivikr trivikr merged commit 79c46f3 into aws:main Apr 26, 2023
3 checks passed
@trivikr trivikr deleted the undeprecate-connection-timeout branch April 26, 2023 20:10
@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConnectionTimeout not working as intended in >=v3.296.0
3 participants