Skip to content

Leaking uncaughtException and unhandledRejection handlers in node #18659

Closed
@hoodmane

Description

@hoodmane

If you start up many emscripten modules in an instance of node, each one adds the same uncaughtException handler and (in node <15) the same unhandledRejection warning. If you start up many modules it will cause a MaxListenersExceededWarning.

It would be better to use a global variable guard so that these are only added once. ex instanceof ExitStatus will only work for the one particular module because each ExitStatus class is distinct, for this changing the check to ex && ex.constructor && ex.constructor.name == "ExitStatus" would make one handler suffice for all Emscripten instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions