Skip to content

finalize callback of instance data is not called when error is thrown #58341

Open
@fs-eire

Description

@fs-eire

Version

24.0.2, 22.15.1

Platform

Windows, macOS (linux not tested)

Subsystem

NAPI

What steps will reproduce the bug?

Please check reproduce steps at https://github.com/fs-eire/node-reproduce-instance-cb-not-called

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

always

What is the expected behavior? Why is that the expected behavior?

finalize callback set by napi_set_instance_data should be always called regardless of whether an uncaught error is thrown. This helps addon to control the lifecycle of native variables.

What do you see instead?

the finalize callback set by napi_set_instance_data is only called when exiting normally. if uncaught error is thrown, it will not be called.

Additional information

See microsoft/onnxruntime#24579 for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    node-apiIssues and PRs related to the Node-API.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions