Node addon "Check failed: IsEmpty()"

122 Views Asked by At

I have a Node addon related to a failure, when I destroy an object. I have no idea which object is causing that. Here is some features I am using.

I have a project where I create a few objects using Napi::ObjectWrap, some asynchronous functions that do CPU work in using Napi::AsyncWorker, I also keep a reference to some class definition constructors, using Napi::Persistent, and calling constructor.SuppressDestruct.

This is the error message I receive

#
# Fatal error in , line 0
# Check failed: IsEmpty().
#
#
#
#FailureMessage Object: 0x7ffc339551c0
 1: 0xb75dd1  [node]
 2: 0x1c08724 V8_Fatal(char const*, ...) [node]
 3: 0xf24789  [node]
 4: 0xf2f718 v8::internal::ScavengerCollector::CollectGarbage() [node]
 5: 0xeafa25 v8::internal::Heap::Scavenge() [node]
 6: 0xebe440  [node]
 7: 0xebee20 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 8: 0xec1d9e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0xe832da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x11fc026 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x15f0a99  [node]
Trace/breakpoint trap

Reading about IsEmpty, I suspected that this could be due to disabling C++ exceptions, my binding.gyp file has -fexceptions in both cflags and cflags_cc, and I removed a define NAPI_DISABLE_CPP_EXCEPTIONS I was using before, but the behavior stays the same.

I worked around this problem by having a global constant instance. While it worked for my current user case, for more complex cases I would like to create and destroy the objects dynamically.

Thank you in advance.

0

There are 0 best solutions below