Skip to content

Instantly share code, notes, and snippets.

@fholzer
Created June 15, 2019 14:58
Show Gist options
  • Save fholzer/03d44449fefb6a9631724a9b4b59b513 to your computer and use it in GitHub Desktop.
Save fholzer/03d44449fefb6a9631724a9b4b59b513 to your computer and use it in GitHub Desktop.
[user@user-pc node-addon-api-tsfn]$ valgrind -s node --expose-gc test/test_binding.js
==6991== Memcheck, a memory error detector
==6991== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6991== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==6991== Command: node --expose-gc test/test_binding.js
==6991==
Consumer::Close called. releasing tsfn...
Consumer::Close called. tsfn released.
ThreadSafeFunction finalizer called
==6991== Invalid write of size 8
==6991== at 0x4858B2F: Napi::details::ThreadSafeFinalize<void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>::Wrapper(napi_env__*, void*, napi_env__*) (napi-inl.h:141)
==6991== by 0x9063E2: void node::Environment::CloseHandle<uv_handle_s, (anonymous namespace)::v8impl::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1}>(uv_handle_s*, (anonymous namespace)::v8impl::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1})::{lambda(uv_handle_s*)#1}::_FUN(uv_handle_s*) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xA6F88C: uv__finish_close (core.c:282)
==6991== by 0xA6F88C: uv__run_closing_handles (core.c:296)
==6991== by 0xA6F88C: uv_run (core.c:366)
==6991== by 0x904524: node::Start(v8::Isolate*, node::IsolateData*, std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0x90272B: node::Start(int, char**) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0x4C11412: (below main) (in /usr/lib64/libc-2.28.so)
==6991== Address 0x811b840 is 0 bytes inside a block of size 8 free'd
==6991== at 0x483A0D6: operator delete(void*, unsigned long) (vg_replace_malloc.c:595)
==6991== by 0x485A1AE: std::default_delete<napi_threadsafe_function__*>::operator()(napi_threadsafe_function__**) const (unique_ptr.h:81)
==6991== by 0x4859B4E: std::unique_ptr<napi_threadsafe_function__*, std::default_delete<napi_threadsafe_function__*> >::~unique_ptr() (unique_ptr.h:274)
==6991== by 0x48596AD: Napi::ThreadSafeFunction::~ThreadSafeFunction() (napi.h:1825)
==6991== by 0x485A2A7: Consumer::~Consumer() (Consumer.h:5)
==6991== by 0x485A2E5: Napi::ObjectWrap<Consumer>::FinalizeCallback(napi_env__*, void*, void*) (napi-inl.h:3405)
==6991== by 0x906189: (anonymous namespace)::v8impl::Reference::SecondPassCallback(v8::WeakCallbackInfo<(anonymous namespace)::v8impl::Reference> const&) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEC0C1A: v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks(std::vector<v8::internal::GlobalHandles::PendingPhantomCallback, std::allocator<v8::internal::GlobalHandles::PendingPhantomCallback> >*, v8::internal::Isolate*) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEC30FB: v8::internal::GlobalHandles::DispatchPendingPhantomCallbacks(bool) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEC3239: v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEFFE39: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xF00C63: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== Block was alloc'd at
==6991== at 0x4838E86: operator new(unsigned long) (vg_replace_malloc.c:344)
==6991== by 0x4859AE7: std::_MakeUniq<napi_threadsafe_function__*>::__single_object std::make_unique<napi_threadsafe_function__*, decltype(nullptr)>(decltype(nullptr)&&) (unique_ptr.h:831)
==6991== by 0x48594C2: Napi::ThreadSafeFunction::ThreadSafeFunction() (napi-inl.h:3882)
==6991== by 0x4858B82: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, void*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void*, void (*)(napi_env__, void*, void*)) (napi-inl.h:3981)
==6991== by 0x4858AC1: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3825)
==6991== by 0x4858A60: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3742)
==6991== by 0x4858818: Consumer::Consumer(Napi::CallbackInfo const&) (Consumer.cc:11)
==6991== by 0x485B25E: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const (napi-inl.h:3279)
==6991== by 0x485C57B: napi_value__* Napi::details::WrapCallback<Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}>(Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}) (napi-inl.h:61)
==6991== by 0x485B371: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*) (napi-inl.h:3277)
==6991== by 0x905BD4: (anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xB8CC1A: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991==
==6991==
==6991== HEAP SUMMARY:
==6991== in use at exit: 72,362 bytes in 1,082 blocks
==6991== total heap usage: 19,300 allocs, 18,218 frees, 32,536,012 bytes allocated
==6991==
==6991== LEAK SUMMARY:
==6991== definitely lost: 192 bytes in 4 blocks
==6991== indirectly lost: 24 bytes in 1 blocks
==6991== possibly lost: 304 bytes in 1 blocks
==6991== still reachable: 71,842 bytes in 1,076 blocks
==6991== suppressed: 0 bytes in 0 blocks
==6991== Rerun with --leak-check=full to see details of leaked memory
==6991==
==6991== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==6991==
==6991== 1 errors in context 1 of 1:
==6991== Invalid write of size 8
==6991== at 0x4858B2F: Napi::details::ThreadSafeFinalize<void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>::Wrapper(napi_env__*, void*, napi_env__*) (napi-inl.h:141)
==6991== by 0x9063E2: void node::Environment::CloseHandle<uv_handle_s, (anonymous namespace)::v8impl::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1}>(uv_handle_s*, (anonymous namespace)::v8impl::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1})::{lambda(uv_handle_s*)#1}::_FUN(uv_handle_s*) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xA6F88C: uv__finish_close (core.c:282)
==6991== by 0xA6F88C: uv__run_closing_handles (core.c:296)
==6991== by 0xA6F88C: uv_run (core.c:366)
==6991== by 0x904524: node::Start(v8::Isolate*, node::IsolateData*, std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0x90272B: node::Start(int, char**) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0x4C11412: (below main) (in /usr/lib64/libc-2.28.so)
==6991== Address 0x811b840 is 0 bytes inside a block of size 8 free'd
==6991== at 0x483A0D6: operator delete(void*, unsigned long) (vg_replace_malloc.c:595)
==6991== by 0x485A1AE: std::default_delete<napi_threadsafe_function__*>::operator()(napi_threadsafe_function__**) const (unique_ptr.h:81)
==6991== by 0x4859B4E: std::unique_ptr<napi_threadsafe_function__*, std::default_delete<napi_threadsafe_function__*> >::~unique_ptr() (unique_ptr.h:274)
==6991== by 0x48596AD: Napi::ThreadSafeFunction::~ThreadSafeFunction() (napi.h:1825)
==6991== by 0x485A2A7: Consumer::~Consumer() (Consumer.h:5)
==6991== by 0x485A2E5: Napi::ObjectWrap<Consumer>::FinalizeCallback(napi_env__*, void*, void*) (napi-inl.h:3405)
==6991== by 0x906189: (anonymous namespace)::v8impl::Reference::SecondPassCallback(v8::WeakCallbackInfo<(anonymous namespace)::v8impl::Reference> const&) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEC0C1A: v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks(std::vector<v8::internal::GlobalHandles::PendingPhantomCallback, std::allocator<v8::internal::GlobalHandles::PendingPhantomCallback> >*, v8::internal::Isolate*) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEC30FB: v8::internal::GlobalHandles::DispatchPendingPhantomCallbacks(bool) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEC3239: v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xEFFE39: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xF00C63: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== Block was alloc'd at
==6991== at 0x4838E86: operator new(unsigned long) (vg_replace_malloc.c:344)
==6991== by 0x4859AE7: std::_MakeUniq<napi_threadsafe_function__*>::__single_object std::make_unique<napi_threadsafe_function__*, decltype(nullptr)>(decltype(nullptr)&&) (unique_ptr.h:831)
==6991== by 0x48594C2: Napi::ThreadSafeFunction::ThreadSafeFunction() (napi-inl.h:3882)
==6991== by 0x4858B82: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, void*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void*, void (*)(napi_env__, void*, void*)) (napi-inl.h:3981)
==6991== by 0x4858AC1: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3825)
==6991== by 0x4858A60: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3742)
==6991== by 0x4858818: Consumer::Consumer(Napi::CallbackInfo const&) (Consumer.cc:11)
==6991== by 0x485B25E: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const (napi-inl.h:3279)
==6991== by 0x485C57B: napi_value__* Napi::details::WrapCallback<Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}>(Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}) (napi-inl.h:61)
==6991== by 0x485B371: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*) (napi-inl.h:3277)
==6991== by 0x905BD4: (anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991== by 0xB8CC1A: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) (in /home/user/software/node-v10.16.0-linux-x64/bin/node)
==6991==
==6991== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[user@user-pc node-addon-api-tsfn]$ valgrind -s node --expose-gc test/test_binding.js
==6943== Memcheck, a memory error detector
==6943== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6943== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==6943== Command: node --expose-gc test/test_binding.js
==6943==
Consumer::Close called. releasing tsfn...
Consumer::Close called. tsfn released.
ThreadSafeFunction finalizer called
==6943== Invalid write of size 8
==6943== at 0x485CB2F: Napi::details::ThreadSafeFinalize<void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>::Wrapper(napi_env__*, void*, napi_env__*) (napi-inl.h:141)
==6943== by 0x968167: void node::Environment::CloseHandle<uv_handle_s, v8impl::(anonymous namespace)::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1}>(uv_handle_s*, v8impl::(anonymous namespace)::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1})::{lambda(uv_handle_s*)#1}::_FUN(uv_handle_s*) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xAF629C: uv__finish_close (core.c:286)
==6943== by 0xAF629C: uv__run_closing_handles (core.c:300)
==6943== by 0xAF629C: uv_run (core.c:370)
==6943== by 0x9D0BDB: node::NodeMainInstance::Run() (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0x967050: node::Start(int, char**) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0x4C11412: (below main) (in /usr/lib64/libc-2.28.so)
==6943== Address 0x7b40ab0 is 0 bytes inside a block of size 8 free'd
==6943== at 0x483A0D6: operator delete(void*, unsigned long) (vg_replace_malloc.c:595)
==6943== by 0x485E1AE: std::default_delete<napi_threadsafe_function__*>::operator()(napi_threadsafe_function__**) const (unique_ptr.h:81)
==6943== by 0x485DB4E: std::unique_ptr<napi_threadsafe_function__*, std::default_delete<napi_threadsafe_function__*> >::~unique_ptr() (unique_ptr.h:274)
==6943== by 0x485D6AD: Napi::ThreadSafeFunction::~ThreadSafeFunction() (napi.h:1825)
==6943== by 0x485E2A7: Consumer::~Consumer() (Consumer.h:5)
==6943== by 0x485E2E5: Napi::ObjectWrap<Consumer>::FinalizeCallback(napi_env__*, void*, void*) (napi-inl.h:3405)
==6943== by 0x94AC69: v8impl::(anonymous namespace)::Reference::SecondPassCallback(v8::WeakCallbackInfo<v8impl::(anonymous namespace)::Reference> const&) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xEE789A: v8::internal::GlobalHandles::InvokeOrScheduleSecondPassPhantomCallbacks(bool) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xEE8B67: v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xF2A4BD: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xF2B786: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xF2C1CE: v8::internal::Heap::PreciseCollectAllGarbage(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== Block was alloc'd at
==6943== at 0x4838E86: operator new(unsigned long) (vg_replace_malloc.c:344)
==6943== by 0x485DAE7: std::_MakeUniq<napi_threadsafe_function__*>::__single_object std::make_unique<napi_threadsafe_function__*, decltype(nullptr)>(decltype(nullptr)&&) (unique_ptr.h:831)
==6943== by 0x485D4C2: Napi::ThreadSafeFunction::ThreadSafeFunction() (napi-inl.h:3882)
==6943== by 0x485CB82: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, void*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void*, void (*)(napi_env__, void*, void*)) (napi-inl.h:3981)
==6943== by 0x485CAC1: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3825)
==6943== by 0x485CA60: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3742)
==6943== by 0x485C818: Consumer::Consumer(Napi::CallbackInfo const&) (Consumer.cc:11)
==6943== by 0x485F25E: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const (napi-inl.h:3279)
==6943== by 0x486057B: napi_value__* Napi::details::WrapCallback<Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}>(Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}) (napi-inl.h:61)
==6943== by 0x485F371: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*) (napi-inl.h:3277)
==6943== by 0x94AB94: v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xB9DF02: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943==
==6943==
==6943== HEAP SUMMARY:
==6943== in use at exit: 6,326 bytes in 28 blocks
==6943== total heap usage: 17,139 allocs, 17,111 frees, 26,061,630 bytes allocated
==6943==
==6943== LEAK SUMMARY:
==6943== definitely lost: 256 bytes in 5 blocks
==6943== indirectly lost: 24 bytes in 1 blocks
==6943== possibly lost: 304 bytes in 1 blocks
==6943== still reachable: 5,742 bytes in 21 blocks
==6943== suppressed: 0 bytes in 0 blocks
==6943== Rerun with --leak-check=full to see details of leaked memory
==6943==
==6943== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==6943==
==6943== 1 errors in context 1 of 1:
==6943== Invalid write of size 8
==6943== at 0x485CB2F: Napi::details::ThreadSafeFinalize<void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>::Wrapper(napi_env__*, void*, napi_env__*) (napi-inl.h:141)
==6943== by 0x968167: void node::Environment::CloseHandle<uv_handle_s, v8impl::(anonymous namespace)::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1}>(uv_handle_s*, v8impl::(anonymous namespace)::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}::operator()(uv_handle_s*) const::{lambda(uv_handle_s*)#1})::{lambda(uv_handle_s*)#1}::_FUN(uv_handle_s*) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xAF629C: uv__finish_close (core.c:286)
==6943== by 0xAF629C: uv__run_closing_handles (core.c:300)
==6943== by 0xAF629C: uv_run (core.c:370)
==6943== by 0x9D0BDB: node::NodeMainInstance::Run() (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0x967050: node::Start(int, char**) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0x4C11412: (below main) (in /usr/lib64/libc-2.28.so)
==6943== Address 0x7b40ab0 is 0 bytes inside a block of size 8 free'd
==6943== at 0x483A0D6: operator delete(void*, unsigned long) (vg_replace_malloc.c:595)
==6943== by 0x485E1AE: std::default_delete<napi_threadsafe_function__*>::operator()(napi_threadsafe_function__**) const (unique_ptr.h:81)
==6943== by 0x485DB4E: std::unique_ptr<napi_threadsafe_function__*, std::default_delete<napi_threadsafe_function__*> >::~unique_ptr() (unique_ptr.h:274)
==6943== by 0x485D6AD: Napi::ThreadSafeFunction::~ThreadSafeFunction() (napi.h:1825)
==6943== by 0x485E2A7: Consumer::~Consumer() (Consumer.h:5)
==6943== by 0x485E2E5: Napi::ObjectWrap<Consumer>::FinalizeCallback(napi_env__*, void*, void*) (napi-inl.h:3405)
==6943== by 0x94AC69: v8impl::(anonymous namespace)::Reference::SecondPassCallback(v8::WeakCallbackInfo<v8impl::(anonymous namespace)::Reference> const&) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xEE789A: v8::internal::GlobalHandles::InvokeOrScheduleSecondPassPhantomCallbacks(bool) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xEE8B67: v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xF2A4BD: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xF2B786: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xF2C1CE: v8::internal::Heap::PreciseCollectAllGarbage(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== Block was alloc'd at
==6943== at 0x4838E86: operator new(unsigned long) (vg_replace_malloc.c:344)
==6943== by 0x485DAE7: std::_MakeUniq<napi_threadsafe_function__*>::__single_object std::make_unique<napi_threadsafe_function__*, decltype(nullptr)>(decltype(nullptr)&&) (unique_ptr.h:831)
==6943== by 0x485D4C2: Napi::ThreadSafeFunction::ThreadSafeFunction() (napi-inl.h:3882)
==6943== by 0x485CB82: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, void, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, void*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}, void*, void (*)(napi_env__, void*, void*)) (napi-inl.h:3981)
==6943== by 0x485CAC1: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, Napi::Object const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3825)
==6943== by 0x485CA60: Napi::ThreadSafeFunction Napi::ThreadSafeFunction::New<char const*, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}>(napi_env__*, Napi::Function const&, char const*, unsigned long, unsigned long, Consumer::Consumer(Napi::CallbackInfo const&)::{lambda(Napi::Env)#1}) (napi-inl.h:3742)
==6943== by 0x485C818: Consumer::Consumer(Napi::CallbackInfo const&) (Consumer.cc:11)
==6943== by 0x485F25E: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const (napi-inl.h:3279)
==6943== by 0x486057B: napi_value__* Napi::details::WrapCallback<Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}>(Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}) (napi-inl.h:61)
==6943== by 0x485F371: Napi::ObjectWrap<Consumer>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*) (napi-inl.h:3277)
==6943== by 0x94AB94: v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943== by 0xB9DF02: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) (in /home/user/software/node-v12.4.0-linux-x64/bin/node)
==6943==
==6943== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment