Skip to content

Possible crash related to Weak refs #33459

@Lokomojo

Description

@Lokomojo
  • Version: 12.16.3
  • Platform: Windows / Linux

I've created a simple test case to reproduce this issue. I'm not certain if it's a bug in my code, Nan, V8 or Node.

https://github.com/CasperTech/NanWeakFunctionTest

How often does it reproduce? Is there a required condition?

100% reproduction - tested on Windows and Linux

What do you see instead?

The test app registers 10,000 callbacks, then clears them and forces a GC clear, then registers them again, every 5 seconds. After the second or third run the app crashes:

Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x0000555555ddb0a7 in v8::internal::GlobalHandles::Create(v8::internal::Object) ()
(gdb) bt
#0  0x0000555555ddb0a7 in v8::internal::GlobalHandles::Create(v8::internal::Object) ()
#1  0x0000555555c90a27 in v8::V8::GlobalizeReference(v8::internal::Isolate*, unsigned long*) ()
#2  0x00007ffff46d0fd0 in TestObject::CreateCallback(Nan::FunctionCallbackInfo<v8::Value> const&) ()
   from NanWeakFunctionTest/build/Release/NanWeakFunctionTest.node
#3  0x00007ffff46cf8a7 in Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfo<v8::Value> const&) ()
   from NanWeakFunctionTest/build/Release/NanWeakFunctionTest.node
#4  0x00005555563daf0d in ?? ()
#5  0x00007fffffffd880 in ?? ()
#6  0x00007fffffffd8b8 in ?? ()

After the second global.gc, not all the Weak references are released, but I understand that GC is unpredictable so this may or may not be related.

Process memory usage only rises to about ~15mb on my system and the system has plenty to spare.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions