posit-dev / posit-dev/positron
Remove Linux workaround for Node 20 crashes in extension builds
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 195
Description
The recent merge of 1.90 upstream introduced a new crash (segfault) in Node 20 when building Positron's extensions on Linux. The crash was determined to be caused by stacking too many concurrent invocations of yarn inside the extension bundler. Here's an example of the crash:
[15:20:58] 'compile-extensions-build' errored after 14 s
[15:20:58] Error: Command failed: yarn list --prod --json
Segmentation fault (core dumped)
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at ChildProcess.emit (node:domain:551:15)
at maybeClose (node:internal/child_process:1105:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:518:28)
at Socket.emit (node:domain:551:15)
at Pipe.<anonymous> (node:net:337:12)
The specific yarn invocation that's crashing is not in Positron at all but part of the @vscode/vsce project, where it is invoked downstream from listFiles.
The fix is somewhat involved; in order to avoid having a bunch of these yarn invocations at once without invasive changes to the build process, we created a work queue that processed only one invocation at a time. The work was done in this commit:
https://github.com/posit-dev/positron/commit/00a05d40f12d6ce51491895d8ca9f16ccb682d71
Work queue processing specifically happens starting here:
It is possible that this problem on Linux is going to be resolved with future updates to Node or the build process, and our workaround will become unnecessary. We should remove this workaround when we are able to do so, since it (slightly) slows down the build process on Linux and also introduces a potential source of merge conflicts with upstream.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in build/lib/extensions.ts around lines 624-641 and review commit 00a05d40f12d6ce51491895d8ca9f16ccb682d71. First verify whether Linux Node 20 still crashes during extension builds when yarn invocations run concurrently. Done means removing the workaround if the crash is resolved and confirming the extension build succeeds on Linux.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100