-
-
Notifications
You must be signed in to change notification settings - Fork 493
Closed
Labels
Description
I added an worker threads test for addon_data.cc:
'use strict';
const buildType = process.config.target_defaults.default_configuration;
const assert = require('assert');
const path = require('path');
const {Worker, isMainThread, workerData} = require('worker_threads');
test(path.resolve(__dirname, `./build/${buildType}/binding.node`));
test(path.resolve(__dirname, `./build/${buildType}/binding_noexcept.node`));
function test(bindingName) {
if (isMainThread) {
work(bindingName);
new Promise(resolve => {
const worker = new Worker(__filename, {workerData: bindingName});
worker.on('exit', () => {
resolve();
});
}).then();
} else {
work(workerData);
}
function work(bindingName) {
const binding = require(bindingName).addon_data(0);
// Make sure it is possible to get/set instance data.
assert.strictEqual(binding.verbose.verbose, false);
binding.verbose = true;
assert.strictEqual(binding.verbose.verbose, true);
binding.verbose = false;
assert.strictEqual(binding.verbose.verbose, false);
}
}
When I ran npm run dev:incremental with node 14.2 it fall on objectwrap test:
> node-addon-api@3.0.0 predev:incremental /home/anfilat/projects/node-addon-api
> node-gyp configure build -C test --debug
make: Entering directory '/home/anfilat/projects/node-addon-api/test/build'
make: Nothing to be done for 'all'.
make: Leaving directory '/home/anfilat/projects/node-addon-api/test/build'
> node-addon-api@3.0.0 dev:incremental /home/anfilat/projects/node-addon-api
> node test
Testing with N-API Version '6'.
Starting test suite
Running test 'addon_data'
Running test 'addon_data-threads'
Running test 'arraybuffer'
Running test 'asynccontext'
Running test 'asyncprogressqueueworker'
Running test 'asyncprogressworker'
Running test 'asyncworker'
Running test 'asyncworker-nocallback'
Running test 'asyncworker-persistent'
Running test 'basic_types/array'
Running test 'basic_types/boolean'
Running test 'basic_types/number'
Running test 'basic_types/value'
Running test 'bigint'
Running test 'date'
Running test 'buffer'
Running test 'callbackscope'
Running test 'dataview/dataview'
Running test 'dataview/dataview_read_write'
Running test 'error'
Running test 'external'
Running test 'function'
Running test 'handlescope'
Running test 'memory_management'
Running test 'name'
Running test 'object/delete_property'
Running test 'object/finalizer'
Running test 'object/get_property'
Running test 'object/has_own_property'
Running test 'object/has_property'
Running test 'object/object'
Running test 'object/object_deprecated'
Running test 'object/set_property'
Running test 'promise'
Running test 'run_script'
Running test 'threadsafe_function/threadsafe_function_ctx'
Running test 'threadsafe_function/threadsafe_function_existing_tsfn'
Running test 'threadsafe_function/threadsafe_function_ptr'
Running test 'threadsafe_function/threadsafe_function_sum'
Running test 'threadsafe_function/threadsafe_function_unref'
Running test 'threadsafe_function/threadsafe_function'
Running test 'typedarray'
Running test 'typedarray-bigint'
Running test 'objectwrap'
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
1: 0xa295e0 node::Abort() [/usr/bin/node]
2: 0x9782df node::FatalError(char const*, char const*) [/usr/bin/node]
3: 0xb9938a v8::Utils::ReportApiFailure(char const*, char const*) [/usr/bin/node]
4: 0xd00c32 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/usr/bin/node]
5: 0xb9b351 v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long) [/usr/bin/node]
6: 0x9e9ed5 napi_get_reference_value [/usr/bin/node]
7: 0x7fa5d842dcf3 Napi::Reference<Napi::Object>::Value() const [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
8: 0x7fa5d8473010 StaticSetter(Napi::CallbackInfo const&, Napi::Value const&) [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
9: 0x7fa5d84773a9 Napi::ObjectWrap<Test>::StaticSetterCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
10: 0x7fa5d8478902 napi_value__* Napi::details::WrapCallback<Napi::ObjectWrap<Test>::StaticSetterCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}>(Napi::ObjectWrap<Test>::StaticSetterCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}) [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
11: 0x7fa5d8477439 Napi::ObjectWrap<Test>::StaticSetterCallbackWrapper(napi_env__*, napi_callback_info__*) [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
12: 0x9e2f0f [/usr/bin/node]
13: 0xc0278b [/usr/bin/node]
14: 0xc03d36 [/usr/bin/node]
15: 0xc043b6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
16: 0x13a5b79 [/usr/bin/node]
Tests aborted with SIGABRT
If skip all test except addon_data-threads it works with node 14. But with node 13 it fall too:
Testing with N-API Version '6'.
Starting test suite
Running test 'addon_data-threads'
All tests passed!
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
1: 0xa0e670 node::Abort() [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
1: 0xa0e670 node::Abort() [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
2: 0xa0ea9c node::OnFatalError(char const*, char const*) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
2: 0xa0ea9c node::OnFatalError(char const*, char const*) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
3: 0xb838ca v8::Utils::ReportApiFailure(char const*, char const*) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
3: 0xb838ca v8::Utils::ReportApiFailure(char const*, char const*) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
4: 0xcfc26a v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
5: 0xb85061 v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
4: 0xcfc26a v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
6: 0x9cea65 napi_get_reference_value [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
7: 0x7f6f4ef74cf3 Napi::Reference<Napi::Object>::Value() const [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
8: 0x7f6f4ef75587 Napi::ObjectWrap<Addon::VerboseIndicator>::~ObjectWrap() [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
5: 0xb85061 v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long) [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
9: 0x7f6f4ef79904 Addon::VerboseIndicator::~VerboseIndicator() [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
6: 0x9cea65 napi_get_reference_value [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
10: 0x7f6f4ef79924 Addon::VerboseIndicator::~VerboseIndicator() [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
11: 0x7f6f4ef76033 Napi::ObjectWrap<Addon::VerboseIndicator>::FinalizeCallback(napi_env__*, void*, void*) [/home/anfilat/projects/node-addon-api/test/build/Debug/binding.node]
7: 0x7f6f4eaad40c Napi::Reference<Napi::Object>::Value() const [/home/anfilat/projects/node-addon-api/test/build/Debug/binding_noexcept.node]
8: 0x7f6f4eaadb7f Napi::ObjectWrap<Addon::VerboseIndicator>::~ObjectWrap() [/home/anfilat/projects/node-addon-api/test/build/Debug/binding_noexcept.node]
12: 0x9c7a0a [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
9: 0x7f6f4eaafade Addon::VerboseIndicator::~VerboseIndicator() [/home/anfilat/projects/node-addon-api/test/build/Debug/binding_noexcept.node]
13: 0x9e427f node_napi_env__::~node_napi_env__() [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
10: 0x7f6f4eaafafe Addon::VerboseIndicator::~VerboseIndicator() [/home/anfilat/projects/node-addon-api/test/build/Debug/binding_noexcept.node]
14: 0x9be02a node::Environment::RunCleanup() [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
11: 0x7f6f4eaae58f Napi::ObjectWrap<Addon::VerboseIndicator>::FinalizeCallback(napi_env__*, void*, void*) [/home/anfilat/projects/node-addon-api/test/build/Debug/binding_noexcept.node]
15: 0xac0a61 node::worker::Worker::Run() [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
16: 0xac0d30 [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
17: 0x7f6f55a6e609 [/lib/x86_64-linux-gnu/libpthread.so.0]
12: 0x9c7a0a [/home/anfilat/projects/node-addon-api/node_modules/node/bin/node]
18: 0x7f6f55995103 clone [/lib/x86_64-linux-gnu/libc.so.6]
Tests aborted with SIGABRT