Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msgpackr unpack throws undefined symbol error #12754

Open
rgillan opened this issue Jul 23, 2024 · 6 comments
Open

msgpackr unpack throws undefined symbol error #12754

rgillan opened this issue Jul 23, 2024 · 6 comments
Labels
bug Something isn't working crash An issue that could cause a crash needs triage runtime

Comments

@rgillan
Copy link

rgillan commented Jul 23, 2024

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 (ae19489) 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

@rgillan rgillan added bug Something isn't working needs triage labels Jul 23, 2024
@Jarred-Sumner
Copy link
Collaborator

Duplicate of #4290

@Jarred-Sumner Jarred-Sumner marked this as a duplicate of #4290 Jul 23, 2024
@Jarred-Sumner
Copy link
Collaborator

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

@Jarred-Sumner Jarred-Sumner closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
@rgillan
Copy link
Author

rgillan commented Jul 23, 2024

Thank you (missed that sorry)

@190n
Copy link
Contributor

190n commented Jul 24, 2024

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.

@190n 190n reopened this Jul 24, 2024
@190n
Copy link
Contributor

190n commented Jul 24, 2024

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.

@190n
Copy link
Contributor

190n commented Jul 26, 2024

I've implemented this overload of v8::Array::New in 48e9242 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.

@nektro nektro added the crash An issue that could cause a crash label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash An issue that could cause a crash needs triage runtime
Projects
None yet
Development

No branches or pull requests

4 participants