Skip to content

Unpack illegal instruction/segfault on Bun #140

@rgillan

Description

@rgillan

It appears that some of the V8 c++ api's are having issues with some npm modules and we think that unpack may be in the same boat. When we do a simple test on the latest Bun (1.1.20) on both RPi4 and RPi5 it crashes.

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));

We raised this as a Bun issue earlier (and it's being worked on) but they pointed us to:
https://github.com/oven-sh/bun/issues/4290

On the RPi4 we get:
bun: symbol lookup error: /opt/iotransit/lib/bun/node_modules/msgpackr-extract/build/Release/extract.node: undefined symbol: _ZN2v85Array3NewEPNS_7IsolateEPNS_5LocalINS_5ValueEEEm

On the RPi5 we get:

Linux Kernel v6.8.0 | glibc v2.39
Args: "bun" "run" "testMsgpack.ts"
Features: jsc 
Builtins: "bun:main" "detect-libc" "node:fs" "node:module" "node:os" "node:path" "node:stream" "node:string_decoder" "node:url" "node:util/types" 
Elapsed: 90ms | User: 84ms | Sys: 35ms
RSS: 1.07GB | Peak: 76.04MB | Commit: 1.07GB | Faults: 0

panic(main thread): Segmentation fault at address 0x63696C732E7481

Expect we will need to wait for Bun to address this but thought it worthwhile sharing in case anyone else runs into the same issue. Thanks for all the effort on this module. pack works out of the box and the performance bump is great.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions