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

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

Open nkomonen-amazon opened this issue 1 year ago • 6 comments

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:

  • create a NodeHttpHandler instance with requestTimeout at its default of 0
  • create a server which responds with multiple chunks of data, but with some arbitrary delay between each chunk (eg 1000ms)

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

nkomonen-amazon avatar Jul 11 '24 18:07 nkomonen-amazon

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

aBurmeseDev avatar Jul 12 '24 21:07 aBurmeseDev

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!

nkomonen-amazon avatar Jul 12 '24 22:07 nkomonen-amazon

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.

aBurmeseDev avatar Jul 29 '24 17:07 aBurmeseDev

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 Aug 09 '24 00:08 github-actions[bot]

.

nkomonen-amazon avatar Aug 09 '24 14:08 nkomonen-amazon

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.

I was getting similar errors when doing local development with the SDK and it turned out to be a proxy / firewall issue.

Any attempts at direct connections to AWS would get cut off by the firewall and "time out" almost immediately.

Configuring the SDK to route traffic through the proxy when doing local development fixed the issue.

The exceptions being thrown weren't particularly helpful in troubleshooting the problem.

timtucker-dte avatar Oct 04 '24 20:10 timtucker-dte

@timtucker-dte - appreciate your input and feedback!

@nkomonen-amazon - there's no updates from the team as issue isn't reproducible. is it still ongoing issue for you? Can you check if you might also have similar connection issue with proxy/firewall as mentioned above?

aBurmeseDev avatar Dec 18 '24 21:12 aBurmeseDev

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 29 '24 00:12 github-actions[bot]

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 Jan 17 '25 00:01 github-actions[bot]