Repository navigation
Conversation
Leave descriptor cleanup to net.Socket to avoid closing reused descriptors. Fixes microsoft#26173
Cover normal socket closure and closure after an error using real FIFOs. Verify that cleanup and repeated reader disposal leave reused descriptors open, with each scenario isolated in a child process.
|
@microsoft-github-policy-service agree |
|
empirically - after this patch no crash for a day, previously 2-3 times a day. So I guess this was it. |
|
🔒 Automated review in progress — Heejae Chang (@heejaechang) is auto-reviewing this PR. |
|
Result: Verification detailsVerification: Isolated verification observed failures that were not classified as caused by this PR: Changed-file lint and formatting checks. Summary: On Linux with Node 22.21.1, offline dependency installation and TypeScript compilation passed. Both new real-FIFO regressions passed, covering descriptor reuse, JSON-RPC delivery, error forwarding, cleanup, and repeated disposal. Three existing reader-consumer tests also passed. Changed-file lint passed, but formatting verification could not complete because my command used a Prettier 3 runner path while this repository specifies Prettier 2. All five targeted tests passed; broader suites and VSIX validation were not run. Test runs: 5 passed, 1 failed
❌
|
Heejae Chang (heejaechang)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
Fixes #26173.
Remove the redundant
fs.close(fd)call from the POSIX FIFO socket's close handler and the unusednoopimport.net.Socketalready closes the descriptor, so closing it again can close an unrelated resource after descriptor reuse and crash the extension host. Add real-FIFO regression tests for normal closure and socket errors, isolated in child processes so descriptor reuse cannot affect the test runner.Testing (Node 22.21.1 unless noted):
npx gulp prePublishNonBundle— passed with Node 22.21.1.npm run lintandnpm run format-check— passed.env -u VIRTUAL_ENV -u PS1 CI_PYTHON_PATH="$PWD/.venv/bin/python" npm run test:unittests— 5,206 passed, 38 pending/skipped.npm run test:functional -- --grep='POSIX named pipe reader'— 2 passed on Node 22.21.1 and Node 24.15.0/libuv 1.51.0. Both checks force descriptor reuse by another file and fail withEBADFon the original code. They also verify JSON-RPC delivery, error forwarding, reader cleanup, and repeated disposal.2026.7.26173; verified its archive, extension entrypoints, native environment helper, and bundled ownership fix.Other:
Suggested label:
bug.