Electron JS app.quit() hang on Linux and Mac
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- csharp, electron, javascript
- Domain
- desktop
Research direction
Reproduce the hang with the simplest module in the repository's examples folder and the linked daniacedue/electron-nodeapi demo. Start at Electron's app.quit() path and the .NET/C# AOT module cleanup, comparing behavior on macOS and Linux. Done means the app exits gracefully after loading the module, allowing electron-updater to start an update without force-killing the process.
Written by the indexing model from the issue text.
Description
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!
- Dominant language
- C#
- Stars
- 783
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/node-api-dotnet
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
microsoft/node-api-dotnet#484 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/node-api-dotnet#481 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/node-api-dotnet#486 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/node-api-dotnet#479 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/node-api-dotnet#475 · 1 comment ·
All issues in microsoft/node-api-dotnet
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·