Open tvmoo9 opened 1 month ago
Hi! Thanks for the report!
If you don't mind, it'd be a bit easier to understand if you did the following:
Thank you!
Hi, I uninstalled v22.4.1 after fully switched to v20.15.1 LTS. Below is the simple code that can reproduce aforementioned "segmentation faults" on v22.4.1. All my other C++ addons have the same memory fault on v22.4.1.
On native C++ side:
#include <napi.h>
using namespace Napi;
Napi::String TestFunc(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
return Napi::String::New(env, "Successful");
}
Napi::Object Init(Napi::Env env, Napi::Object exports) {
exports.Set(Napi::String::New(env, "TestFunc"),
Napi::Function::New(env, TestFunc));
return exports;
}
NODE_API_MODULE(addon, Init)
On Nodejs side:
const addon = require('../build/Release/test-native');
console.log(addon.TestFunc());
Thanks.
Thanks! I've pinged the relevant teams.
Are you following the instructions at https://nodejs.org/docs/latest/api/addons.html to build the addon?
Ping @nodejs/node-api
(To members) should this be here, or nodejs/help
?
Thanks! I've pinged the relevant teams.
Are you following the instructions at https://nodejs.org/docs/latest/api/addons.html to build the addon?
Ping @nodejs/node-api
(To members) should this be here, or
nodejs/help
?
I thinks I did.
Doesn't seem to be reproducible on mac. Might be a linux only problem. Would you mind sharing more information about the crash, like backtrace?
Can't reproduce on linux either
@tvmoo9 just wondering if you are still facing the issue. Since it's not reproduciable by the node-api team we'll close unless we hear back from you in the next week.
@tvmoo9, can you share which version of Debian you were running on as we can't tell that from the info shared so far.
@tvmoo9, can you share which version of Debian you were running on as we can't tell that from the info shared so far.
The Debian version is 12.6 which has this issue. The same code has no problem with Ubuntu 24.04. No other Linux distributions tested so far.
Version
v22.4.1
Platform
Subsystem
node-addon-api
What steps will reproduce the bug?
Run a simple hello-world C++ wrapper addon test by following https://www.npmjs.com/package/generator-napi-module, it returns "segmentation faults" runtime error; there is no such an error for v20.15.1 and v20.14.0 which are only other two versions tested.
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
No runtime error
What do you see instead?
Segmentation faults
Additional information
No response