Skip to content

Electron JS app.quit() hang on Linux and Mac #483

Description

@daniacedue

Hello,

If I use this technology in an Electron JS desktop application to load a C# AOT or .Net module then on Mac OS (and also Linux) the call to app.quit() hangs and the app does not closes normally, needing to do a force quit from Activity Monitor.

It happens with the simplest possible module found in your examples folder, as it is too much code I have made a demo app here:
[daniacedue/electron-nodeapi] (https://github.com/daniacedue/electron-nodeapi)

As a workaround I have tried brutally closing the process after some time or in the Electron's app.quit() handler by doing process.kill(process.pid, "SIGKILL"); but this is problematic because I need electron-updater npm package to be able to gracefully close in order to kick-off an update.

The problem is quite complex, I have also tried asking some chatbots to figure out what is happening by interpreting some stack traces and spindumps and it has something to do with low-level NAPI calls freezing the main process when doing the cleanup.
I have tried numerous "black box" possible fixes from both C# and JS (like explicit "destroy" function triggering dispose pattern because I was doubting the finalizers being the culpit) but without success.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions