purr-data icon indicating copy to clipboard operation
purr-data copied to clipboard

macOS: nwjs sometimes crashes on exit

Open agraef opened this issue 1 year ago • 0 comments

When run from the command line, you'll see an error message like the following, followed by a stack trace:

[25619:259:0817/142245.740083:ERROR:extension_function_dispatcher.cc(588)] Permission denied for nw.Obj.allocateId

These only seem to happen when exiting while some patch windows are still open (closing all windows before quitting eliminates the issue), and only if NW2 mode is disabled (which we now always do because of serious JavaScript performance issues with NW2).

Not much that can be done about this, I'm afraid, as the segfault happens in nw.js. But those crashes actually seem harmless, they happen after the application has already shut down properly. The only annoyance is that they may trigger the Mac crash reporter which will ask you whether to send a crash report to Apple. The crash reporter can be turned off, however, using these commands:

launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist

It can also be turned on again if needed:

launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist

NB: It appears that these commands work on all recent macOS releases (tested on Ventura). There might be better ways to do this, though; if anyone knows any, please share them here, thanks!

agraef avatar Aug 22 '24 01:08 agraef