dj
djβ€’17mo ago

Node-API related segmentation fault

Any idea what could be causing this crash? I'm using Node-API and the same module is working fine in Node.js. Can't figure out the exact part causing this to create a reproducible example πŸ€”
8 Replies
dj
djOPβ€’17mo ago
cc @littledivy any idea?
dj
djOPβ€’17mo ago
so it comes down to this specific part. Let me check what could be causing this in native land
dj
djOPβ€’17mo ago
So the error comes down to napi_create_external seems that finalizer cb being null is not handled correctly in deno
divy
divyβ€’17mo ago
oh huh whats being finalized?
dj
djOPβ€’17mo ago
I created an external with no finalizer callback (nullptr) and - deno just treats it as normal c callback and goes ahead to call it sometime - node will check if its null then its not called
AapoAlas
AapoAlasβ€’17mo ago
You never know if someone has placed a function at memory slot 0... (Apparently in some architectures it is a valid memory address.)
dj
djOPβ€’17mo ago
that’s probably a case to not worry about πŸ˜† in standard conforming C/C++ implementations, I guess it is possible to reliably set a function pointer to null.
AapoAlas
AapoAlasβ€’17mo ago
Yeah πŸ™‚