Open rgillan opened 1 month ago
Duplicate of #4290
This is caused by us not supporting V8 C++ APIs. We are tracking this in #4290. @190n is working on it. Please follow along in #4290
Thank you (missed that sorry)
Your code sample actually works fine for me on macOS and on a Linux ARM VM. msgpackr claims to work on Deno and Bun. I think it must be crashing on your system for a reason other than missing V8 API support so I'm gonna reopen this.
Sorry, I'd mistyped your reproduction. I can reproduce a segfault which occurs if libnode109
is installed, because msgpackr-extract
picks up the definition of v8::Array::New
and calls it with JSC values while that expects V8 values. Weirdly, I don't get the missing symbol error if libnode109 is not installed, instead it runs properly.
I've implemented this overload of v8::Array::New
in 48e9242ce on #12821, which makes your code work for me on a Linux aarch64 VM. I was never able to reproduce the illegal instruction error, so if you still get that it might be a different issue, but that should fix the segfault and the undefined symbol error once it lands.
What version of Bun is running?
1.1.20+ae1948925
What platform is your computer?
Linux 6.8.0-1004-raspi aarch64 aarch64
What steps can reproduce the bug?
When using the msgpackr module, specifically unpack, bun crashes. On a RPi4, it crashes with an illegal instruction error; on a RPI5 it gives a segfault. Runs fine under nodejs. Some quick test code: `const { pack, unpack } = require ('msgpackr'); var msgpack = require ('msgpack5')();
let sendMsg = {"t":"ce","p":{"cmd":"getdevices","username":"test","domain":"dummy.com","appletId":"dm","filter":"{\"domain\": {\"$in\":[\"au.net\",\"au.ft.net\",\"au.swarm.net\",\"be.dev.net\",\"be.ft.net\",\"be.swarm.net\",\"ci.net\",\"ft.net\",\"qa.net\",\"us.dev.net\",\"us.ft.net\",\"us.swarm.net\"]},\"fields\":[\"_id\",\"dId\",\"domain\",\"status\",\"dto\",\"connection\",\"nwRegion\",\"nwIPAddress\",\"queuedMessages\",\"country\",\"agentRevision\",\"xt\"]}"}};
console.log('send: ' + JSON.stringify(sendMsg));
let packed = pack(sendMsg);
console.log('packed: ' + JSON.stringify(packed));
let rcvMsg = {};
rcvMsg = msgpack.decode(packed);
console.log('works with both: ' + JSON.stringify(rcvMsg));
rcvMsg = unpack(packed);
console.log('works nodejs, fails bun: ' + JSON.stringify(rcvMsg));`
What is the expected behavior?
We expect the msgpackr unpack to take the packed binary buffer and return the original JSON object.
What do you see instead?
On RPi4, the unpack call returns:
bun: symbol lookup error: /opt/iotransit/lib/bun/node_modules/msgpackr-extract/build/Release/extract.node: undefined symbol: _ZN2v85Array3NewEPNS_7IsolateEPNS_5LocalINS_5ValueEEEm
On RPi5, the unpack causes a segfault: `============================================================ Bun v1.1.20 (ae194892) Linux arm64 Linux Kernel v6.8.0 | glibc v2.39 Args: "bun" "run" "testMsgpack.js" Features: jsc Builtins: "bun:main" "detect-libc" "node:assert" "node:buffer" "node:events" "node:fs" "node:module" "node:os" "node:path" "node:stream" "node:string_decoder" "node:url" "node:util" "node:util/types" Elapsed: 124ms | User: 98ms | Sys: 36ms RSS: 1.07GB | Peak: 74.46MB | Commit: 1.07GB | Faults: 0
panic(main thread): Segmentation fault at address 0xED200001C05 oh no: Bun has crashed. This indicates a bug in Bun, not your code.
`
Additional information
No response