Getting the following errror on GitHub - bevry/coda-packs: Monorepo of Coda packs
> npx coda upload packs/formatting/pack.ts
Building Pack bundle...
Existing directory ./_upload_build detected. Probably left over from previous build. Removing it...
(node:95643) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
fish: Job 1, 'npx coda upload packs/formattin…' terminated by signal SIGSEGV (Address boundary error)
> npx coda execute packs/formatting/pack.ts Html '<sup>hello</sup>'
fish: Job 1, 'npx coda execute packs/formatti…' terminated by signal SIGSEGV (Address boundary error)
> npx coda --version
1.3.0
Debugging steps that also failed
Did some digging, it’s either a bug with say a native package, or node.js itself
opened 09:02AM - 06 May 20 UTC
closed 10:15PM - 15 Dec 20 UTC
confirmed-bug
buffer
v14.x
<!--
Thank you for reporting an issue.
This issue tracker is for bugs and is… sues found within Node.js core.
If you require more general support please file an issue on our help
repo. https://github.com/nodejs/help
Please fill in as much of the template below as you're able.
Version: output of `node -v`
Platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
Subsystem: if known, please specify affected core module name
-->
* **Version**: v14.2.0
* **Platform**: mac OS 10.13.6
### What steps will reproduce the bug?
When communicating a Uint8 Array Buffer from a worker to the parent process with `postMessage`, which is included in the `transferList` argument and then calling `unref` on the worker, I get a Segfault: `'node index.js' terminated by signal SIGSEGV (Address boundary error)`.
`index.js`
```js
const path = require('path')
const { Worker } = require('worker_threads')
const worker = new Worker(path.join(__dirname, 'worker.js'))
worker.postMessage({})
worker.on('message', (message) => {
const hash = Buffer.from(message.value).toString('hex')
console.log(hash)
worker.unref()
})
```
`worker.js`
```js
const fs = require('fs')
const crypto = require('crypto')
const { parentPort } = require('worker_threads')
parentPort.on('message', (message) => {
const hasher = crypto.createHash('sha256')
fs.createReadStream('example.txt')
.pipe(hasher)
.on('finish', () => {
const { buffer } = hasher.read()
parentPort.postMessage({ value: buffer }, [buffer])
})
})
```
Reproduction here: https://github.com/timsuchanek/segfault-node-14
### lldb backtrace
```
Process 40610 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
frame #0: 0x000000010007b095 node`node::Buffer::New(node::Environment*, char*, unsigned long, bool)::$_2::__invoke(void*, unsigned long, void*) + 21
node`node::Buffer::New(node::Environment*, char*, unsigned long, bool)::$_2::__invoke(void*, unsigned long, void*):
-> 0x10007b095 <+21>: movq 0x20(%rcx), %rcx
0x10007b099 <+25>: movq %rax, %rdi
0x10007b09c <+28>: popq %rbp
0x10007b09d <+29>: jmpq *%rcx
Target 0: (node) stopped.
```
This works fine in Node 13 or lower and it seems, that this bug was introduced in Node 14.
opened 02:40PM - 24 Apr 21 UTC
closed 06:33AM - 15 Jul 21 UTC
kind: bug
### What version of Next.js are you using?
10.1.3
### What version of Node.js … are you using?
16.0.0
### What browser are you using?
Chrome, Firefox
### What operating system are you using?
macOS 11.2.3
### How are you deploying your application?
next dev
### Describe the Bug
Mac Mini M1, Node 16 next start crashes hitting next/images
Already nuked node_modules and locks after updating node version
```
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from /Users/vfornito/DEV/gvdp/vdp/.env.development
info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
(node:2822) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/vfornito/DEV/gvdp/node_modules/next/node_modules/postcss/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
error Command failed with signal "SIGSEGV".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
### Expected Behavior
To work :)
### To Reproduce
Use a simple next/image on a next.js project. Either using js or TS does not change the behavior
Will try another node version.
Ya, I’ve been seeing some segfaults with the CLI recently when using Node 19 in a GitHub Codespace, but not even consistently (fails for some codespaces but not others). Downgrading to Node 18 seems to resolve it.
2 Likes
Can confirm moving from Node 19 to Node 18 fixes it.