aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.02k stars 565 forks source link

`node-http-handler` unexpected `TimeoutError` from socket #6271

Open nkomonen-amazon opened 1 month ago

nkomonen-amazon commented 1 month ago

Checkboxes for prior research

Describe the bug

We are using the @aws-sdk/client-sso-oidc which looks to use @smithy/node-http-handler. The core of the issue looks to be with @smithy/node-http-handler.

In the user telemetry of our products AWS Toolkit for VS Code and Amazon Q for VS Code, we sometimes see the error TimeoutError, with the message Connection timed out after 0 ms. It looks to be coming from setSocketTimeout. In our attempt to fix this we set a value of 30_000 in the requestTimeout field which is eventually used here, and then we started to instead see Connection timed out after 30000 ms. This seems to validate that the problem is coming from setSocketTimeout

The docs say that the timeout should be disabled at 0ms.

SDK version number

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20+

Reproduction Steps

Cannot reproduce myself as it is sporadic, we see it in user telemetry though.

Minimal steps from my guess would be to:

My guess is that since the request has multiple chunks you will get a TimeoutError since it will timeout before the next chunk is sent???? Below in the Additional Context section it seems like the socketTimeout should reset when new chunks are received.

Observed Behavior

Unexpected TimeoutError

Expected Behavior

Don't get a TimeoutError

Possible Solution

It looks that in setSocketTimeout we still set the timeout even if it is 0. If we return early will this be enough to fix the issue?

Additional Information/Context

aBurmeseDev commented 1 month ago

Hi @nkomonen-amazon - thanks for reaching out.

I'm not seeing any recent change to @smithy/node-http-handler that's relevant to what you're reporting, however you're on older version. See version history here. Can you try the recent version?

If issue persists, please provide minimal repro for us to further investigate. Feel free to cut internal SIM to the team as well. Best, John

nkomonen-amazon commented 1 month ago

Hey John!

The code that I assume has an issue is over a year old, so I don't think a newer version is the fix. The issue is happening for a subset of our users, so I cannot reproduce the problem myself.

I've opened a SIM ticket as well.

Thanks!

aBurmeseDev commented 1 month ago

Thanks for your response. Our team has received an internal ticket for further investigation. However, to better understand and examine the reported behavior, we request that you provide us with a minimal reproducible code snippet or example that demonstrates the problem. Additionally, any relevant logs or diagnostic information that could offer more insights into the issue would be extremely helpful for our analysis.

github-actions[bot] commented 2 weeks ago

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.

nkomonen-amazon commented 2 weeks ago

.