Skip to content

NAPI custom gc segfault #2555

@BlobMaster41

Description

@BlobMaster41

My program segfault fatally after ~30minutes with a reference deletion problem. Here is the full backtrace from gdb:

0x00000000013ea173 in v8::internal::GlobalHandles::Destroy(unsigned long*) ()
(gdb) bt
#0  0x00000000013ea173 in v8::internal::GlobalHandles::Destroy(unsigned long*) ()
#1  0x0000000000f06292 in v8impl::Reference::~Reference() ()
#2  0x0000000000f1158b in napi_delete_reference ()
#3  0x00007ffed4c5bfdf in napi::bindgen_runtime::module_register::custom_gc (env=0x7ffe2820f580, _js_callback=0x7ffe2806f4a8, _context=0x0, data=0x7ffc5aaebcc0) at src/bindgen_runtime/module_register.rs:634
#4  0x0000000000f2cbc9 in v8impl::(anonymous namespace)::ThreadSafeFunction::AsyncCb(uv_async_s*) ()
#5  0x0000000001d2bc43 in uv__async_io (loop=0x7ffe3fbff998, w=<optimized out>, events=<optimized out>) at ../deps/uv/src/unix/async.c:176
#6  0x0000000001d40974 in uv__io_poll (loop=loop@entry=0x7ffe3fbff998, timeout=<optimized out>) at ../deps/uv/src/unix/linux.c:1528
#7  0x0000000001d2c967 in uv_run (loop=0x7ffe3fbff998, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:448
#8  0x0000000000e726d6 in node::SpinEventLoopInternal(node::Environment*) ()
#9  0x00000000010aa387 in node::worker::Worker::Run() ()
#10 0x00000000010aa539 in node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::{lambda(void*)#1}::_FUN(void*) ()
#11 0x00007ffff789caa4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#12 0x00007ffff7929c3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

It seems that there is a problem in a async function cleaning up a buffer object in custom_gc:

https://github.com/napi-rs/napi-rs/blob/napi%402.16.17/crates/napi/src/bindgen_runtime/module_register.rs#L602

I have no clue how to replicate easily but it does happen.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions