Skip to content

Error: write ECONNABORTED in node after blocking for long enough #6861

@simonbuchan

Description

@simonbuchan

Checkboxes for prior research

Describe the bug

When using a blocking call for long enough in node like (for windows) execSync("cmd /c timeout 35", { stdio: "inherit" }) seemingly prevents existing socket timeout code from triggering and instead of ECONNRESET you get ECONNABORTED from node and the AWS SDK simply fails immediately without attempting a retry.

Interestingly I can't trigger this with the STS service (when trying to avoid anything environment specific), so it may be specific to the cloudformation server configuration - I haven't tested with other services yet though.

Regression Issue

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

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20.18.0

Reproduction Steps

import cp from "node:child_process";

import { CloudFormation } from "@aws-sdk/client-cloudformation";
import { fromIni } from "@aws-sdk/credential-providers";

const credentials = fromIni({ profile: "test" });
const client = new CloudFormation({ credentials, region: "us-east-1" });
await client.listStacks();
cp.execSync("cmd /c timeout 35", { stdio: "inherit" });
await client.listStacks();

Observed Behavior

node:internal/modules/run_main:129
    triggerUncaughtException(
    ^

Error: write ECONNABORTED
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:95:16)
    at writevGeneric (node:internal/stream_base_commons:139:26)
    at Socket._writeGeneric (node:net:952:11)
    at Socket._writev (node:net:961:8)
    at doWrite (node:internal/streams/writable:594:12)
    at clearBuffer (node:internal/streams/writable:773:5)
    at Writable.uncork (node:internal/streams/writable:529:7)
    at ClientRequest._flushOutput (node:_http_outgoing:1173:10)
    at ClientRequest._flush (node:_http_outgoing:1142:22)
    at onSocketNT (node:_http_client:907:9) {
  errno: -4079,
  code: 'ECONNABORTED',
  syscall: 'write',
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

Expected Behavior

SDK should retry the request.

Possible Solution

Hacking in "ECONNABORTED" to NODEJS_TIMEOUT_ERROR_CODES in @smithy/node-http-handler seems to fix it.

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueresponse-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