Skip to content

Crash on node api add-on finalization #37236

@legendecas

Description

@legendecas
  • Version: v10.23.2, v12.20.1, v14.15.4, v15.8.0 (all latest lts and current version)
  • Platform: all
  • Subsystem: node-api

What steps will reproduce the bug?

Repo to re-produce: https://github.com/legendecas/repro-napi-v8impl-refbase-double-free

$ make
v14.15.4
force gc
fish: 'node --expose_gc index.js' terminated by signal SIGSEGV (Address boundary error)

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

Always.

What is the expected behavior?

No segment faults.

What do you see instead?

Segment faults on double free of v8impl::<anonymous>::RefBase. The RefBases were deleted once one module's napi_env was going to destroy, and the installed weak v8impl::Persistents of v8impl::<anonymous>Reference was not destroyed and these RefBase will be deleted again on finalization callbacks.

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.node-apiIssues and PRs related to the Node-API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions