Repository navigation
Intermittent failure in ThreadSafe function #906
Copy link
Copy link
Closed
Labels
Description
Failure in recent nightly run: @gabrielschulhof, @KevinEady as our threadsafe experts.
https://ci.nodejs.org/job/node-test-node-addon-api-new/nodes=fedora-latest-x64/3589/console
Running test 'threadsafe_function/threadsafe_function'
#
# Fatal error in , line 0
# Check failed: !object.IsSmi().
#
#
#
#FailureMessage Object: 0x7ffcf7a31110
1: 0xae7a01 [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
2: 0x1b043b4 V8_Fatal(char const*, ...) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
3: 0xea7e92 v8::internal::PagedSpace::AllocateRawSlow(int, v8::internal::AllocationAlignment, v8::internal::AllocationOrigin) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
4: 0xe3d8a6 v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
5: 0xe455c8 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
6: 0xe0925a v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
7: 0xe04c72 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
8: 0xe04d24 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
9: 0x1070bae v8::internal::Handle<v8::internal::FixedArray> v8::internal::String::CalculateLineEnds<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>, bool) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
10: 0x1031483 void v8::internal::Script::InitLineEnds<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Script>) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
11: 0x104554b v8::internal::Script::GetLineNumber(v8::internal::Handle<v8::internal::Script>, int) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
12: 0xdd5fc3 v8::internal::JSStackFrame::GetLineNumber() [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
13: 0xe13623 v8::internal::Factory::NewStackFrameInfo(v8::internal::Handle<v8::internal::FrameArray>, int) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
14: 0x1060928 v8::internal::StackTraceFrame::InitializeFrameInfo(v8::internal::Handle<v8::internal::StackTraceFrame>) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
15: 0x1060b00 v8::internal::StackTraceFrame::GetFrameInfo(v8::internal::Handle<v8::internal::StackTraceFrame>) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
16: 0x1063c85 v8::internal::SerializeStackTraceFrame(v8::internal::Isolate*, v8::internal::Handle<v8::internal::StackTraceFrame>, v8::internal::IncrementalStringBuilder*) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
17: 0x106480c v8::internal::SerializeStackTraceFrame(v8::internal::Isolate*, v8::internal::Handle<v8::internal::StackTraceFrame>) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
18: 0xcdb3d4 [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
19: 0xce32f6 v8::internal::Builtin_CallSitePrototypeToString(int, unsigned long*, v8::internal::Isolate*) [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
20: 0x1505f79 [/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-v16.0.0-nightly20210209beee53884d-linux-x64/bin/node]
Tests aborted with SIGILL
npm ERR! code 1
npm ERR! path /home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/node-addon-api
npm ERR! command failed
npm ERR! command sh -c node test
npm ERR! A complete log of this run can be found in:
npm ERR! /home/iojs/build/workspace/node-test-node-addon-api-new/nodes/fedora-latest-x64/npm-cache/_logs/2021-02-10T09_48_16_307Z-debug.log
Build step 'Conditional steps (multiple)' marked build as failure
Sending e-mails to: michael_dawson@ca.ibm.com gabriel.schulhof@intel.com Arunesh.Chandra@microsoft.com
Collecting metadata...
Metadata collection done.
Notifying upstream projects of job completion
Finished: FAILUREReactions are currently unavailable
Activity
mhdawson commentedon Feb 12, 2021
Also seeing occasional failure like this one: https://ci.nodejs.org/job/node-test-node-addon-api-new/nodes=ubuntu1604-64/3564/console
gabrielschulhof commentedon Feb 16, 2021
@mhdawson this looks like it's against Node.js nightly. Might it be a regression in core?
gabrielschulhof commentedon Feb 16, 2021
The stack doesn't seem to contain any of our frames – unless I'm glossing over some.
gabrielschulhof commentedon Feb 17, 2021
I built against nodejs/node@1c6484b and got
gabrielschulhof commentedon Feb 18, 2021
Hmmm ... I can't reproduce that crash.
gabrielschulhof commentedon Feb 18, 2021
Trying to reproduce inside an Ubuntu 16.04 container.
mhdawson commentedon Mar 22, 2021
The crash on shutdown with master ow seems to recreate consistently:
@gabrielschulhof I'm wondering if that might be related to the change from nodejs/node#37616. Any chance you still have the environment you had for that PR to compare before/after the change?
mhdawson commentedon Mar 22, 2021
Cutting down the test case this is the one that is failing:
mhdawson commentedon Mar 22, 2021
Cut down test case to these 2 and it still crashes:
() => { binding.objectreference.setObjects("hello", "world", "javascript"); const test = binding.objectreference.getFromValue(); const test2 = binding.objectreference.getFromValue("hello"); assert.deepEqual({ hello: "world" }, test); assert.deepEqual({ hello: "world" }, test2); assert.deepEqual(test, test2); }, () => { binding.objectreference.setObjects(1, "hello world"); const test = binding.objectreference.getFromValue(); const test2 = binding.objectreference.getFromGetter(1); assert.deepEqual({ 1: "hello world"}, test); assert.equal("hello world", test2); assert.equal(test[1], test2); },mhdawson commentedon Mar 22, 2021
But not with just one of the 2
mhdawson commentedon Mar 22, 2021
Just these 2 also seems to recreate
() => { binding.objectreference.setObjects(1, "hello world"); const test = binding.objectreference.getFromValue(); const test2 = binding.objectreference.getFromGetter(1); assert.deepEqual({ 1: "hello world"}, test); assert.equal("hello world", test2); assert.equal(test[1], test2); }, () => { binding.objectreference.setObjects(0, "hello"); binding.objectreference.setObjects(1, "world"); const test = binding.objectreference.getFromValue(); const test2 = binding.objectreference.getFromGetter(0); const test3 = binding.objectreference.getFromGetter(1); assert.deepEqual({ 1: "world"}, test); assert.equal(undefined, test2); assert.equal("world", test3); },mhdawson commentedon Mar 22, 2021
May require 2 tests so that a gc is forced after one of the tests complete ?
mhdawson commentedon Mar 22, 2021
Cutting down the tests to just:
still recreates
So it seems like just creating a Weak causes it? The strange thing is that I would have thought the C node-api tests would have caught an issue like that.
mhdawson commentedon Mar 22, 2021
I've got to think its related to nodejs/node#37616, give the output of the crash being:Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x0000000000e7acb0 in v8::internal::GlobalHandles::ClearWeakness(unsigned long*) ()
mhdawson commentedon Mar 22, 2021
I'm done today and booked for most of tomorrow. @gabrielschulhof I also changed nodejs/node#37802 (review) to "requested changes" so that we don't land until we figure this out.
68 remaining items
mhdawson commentedon May 4, 2021
Ok so another 4604 runs with the debug version of Node.js over a few days and no recreate of the 1 byte invalid read. At this point I'm going to focus on getting nodejs/node#38492 into a shape where it can land.
We should also start working on getting the other PRs from main backported to master. Those include:
node-api: fix shutdown crashes
node-api: fix shutdown crashes
node-api: fix shutdown crashes
node-api: fix shutdown crashes
node-api: fix shutdown crashes
node-api: fix shutdown crashes
github-actions commentedon Aug 3, 2021
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
mhdawson commentedon Aug 3, 2021
Should have closed this issue as the PR to resolve was landed.
node-api: fix crash in finalization
node-api: fix shutdown crashes
node-api: fix crash in finalization
node-api: fix shutdown crashes