Skip to content

AsyncHookCleanupHandle is not ABI safe across different versions of the std lib #36349

@implausible

Description

@implausible
  • Version: Any version
  • Platform: All platforms
  • Subsystem: native modules

What steps will reproduce the bug?

  1. Create a native node module that uses NaN and async cleanup behavior via node::AddEnvironmentCleanupHook.
  2. Compile for Electron 10.1.4 or higher
  3. Failure to build, because std::unique_ptr is not an ABI compatible interface

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

It reproduces when node is compiled for a different version of C++ than what MSVC uses with node-gyp. It looks like Chromium and therefore Electron switched which c++ stdlib it uses internally in M75.

What is the expected behavior?

Native modules should be able to use this API regardless of whether we're compiling for Electron or Node.

What do you see instead?

node-gyp cannot compile native modules for Electron when referencing a method that uses AsyncCleanupHookHandle, because it is just a typedef of std::unique_ptr.

Additional information

This is an issue with the changes implemented in response to this issue #34715. I think this is just something that was overlooked as when I inspected related code it looks like developers and reviewers were aware of this as an issue in the first place :) See https://github.com/nodejs/node/blob/master/src/api/hooks.cc#L103-L106.

@addaleax Help would be much appreciated :) We were unable to launch NodeGit for Electron 11 because of this :(.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions