Skip to content

fix(net): preserve destroy errors when canceling in-flight writes - #70

Merged
steipete merged 2 commits into
mainfrom
claude/w67-socket-destroy-write
Oct 2, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/w67-socket-destroy-write

Conversation

@steipete

@steipete steipete commented Oct 2, 2026

Copy link
Copy Markdown

A pending socket write previously received ERR_SOCKET_CLOSED synchronously from the native close handler before an explicit destroy(error) reached the stream. A forwarding Duplex could therefore finish with the generic socket error instead of the owner's cancellation reason.

Ports the open upstream oven-sh/bun#43250, with credit to @robobun. Detach in-flight write callbacks before native teardown, then report Node's write ECANCELED after the explicit error and before close. A guard prevents a connect-wait listener from completing an already-canceled write twice. The native socket ownership and public API remain unchanged.

Validation: on AWS Linux with Node 24.21.0 as the oracle, the new matrix has 12 Node passes and 12 Bun failures before the fix. After the fix, both full net/TLS files pass (280 tests, 9 skips, zero failures; 10.37 seconds), covering TCP/TLS, client/server writes, corked batches, reset, and destroy callbacks. Built-in TypeScript checks pass. P2 Codex review is scoped-clean before commit; branch review and exact-head Linux/macOS lanes gate landing.

@autofix-troubleshooter

Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

@steipete
steipete force-pushed the claude/w67-socket-destroy-write branch from 8d0f7fa to d00efae Compare October 2, 2026 06:34
@steipete
steipete merged commit b3e1271 into main Oct 2, 2026
7 checks passed
@steipete
steipete deleted the claude/w67-socket-destroy-write branch October 2, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants