Nw.js: Crash on First Launch

Created on 2 Apr 2017  Â·  30Comments  Â·  Source: nwjs/nw.js

The most recent build of my application (Shaxpir) has been crashing on first launch, on Mac OS Sierra, and I'm not sure why... I'm using NWJS 0.21.4, but I'm using my own build scripts to do code-signing and building the PKG installer. When I start the application, the icon appears in the dock for about one second, and then disappears. The main application window never appears.

If I open the Console application, I can see the following error message in system.log:

Apr  2 13:50:37 Benjis-MBP Shaxpir[51902]: [0402/135037.372796:FATAL:chrome_main_delegate.cc(792)] Check failed: !command_line.HasSwitch(switches::kProcessType) && process_type.empty(). Main application forbids --type, saw renderer
    0   nwjs Framework                      0x000000010a11aa73 _ZN2v88UnlockerD1Ev + 15204243
    1   nwjs Framework                      0x000000010a133bf7 _ZN2v88UnlockerD1Ev + 15307031
    2   nwjs Framework                      0x000000010883ebc3 ChromeMain + 3539
    3   nwjs Framework                      0x000000010883ecd4 ChromeMain + 3812
    4   nwjs Framework                      0x0000000109d4fd42 _ZN2v88UnlockerD1Ev + 11227746
    5   nwjs Framework                      0x0000000109d4f39e _ZN2v88UnlockerD1Ev + 11225278
    6   nwjs Framework                      0x000000010883de3b ChromeMain + 75
    7   Shaxpir                             0x0000000105a60daa main + 522
    8   libdyld.dylib                       0x00007fff988ac255 start + 1
    9   ???                                 0x0000000000000017 0x0 + 23
Apr  2 13:50:37 Benjis-MBP com.apple.xpc.launchd[1] (com.shaxpir.desktop.230176[51898]): Service exited with abnormal code: 5

I've attached two crash-dump files generated during this crash:

crash-dumps.zip

If anyone can help me understand why this crash is occurring, and what I might need to do to fix it, I'd be very grateful!

P1 bug cant-reproduce triaged

Most helpful comment

Actually, @rogerwang, I think you did reproduce the bug... For some reason, the PKG installer isn't being built correctly (no helper app!) and therefore it crashes on first launch.

The reason I filed this bug is because there's no reliable tooling for building and signing a PKG installer of a NWJS app for Macintosh, so I cobbled together a build script the best I could... And it seemed to work pretty well for a year, only to stop working recently (with 0.21.4). But I don't know why it stopped working... Has something changed recently in the internal NWJS directory structure on Mac?

I tried referring to the Support for Mac App Store instructions, but they seem to be out of date.

All 30 comments

Do you use --type for your app? It's reserved.

Hmmmm... I don't use --type or any other flags...

Incidentally, if i delete the existing app and reinstall from scratch, it works just fine. The app only crashes if I install an update. So, for example, if I start out by installing version 4.0.0:

https://s3.amazonaws.com/shaxpir-installers/install-shaxpir-4.0.0.pkg

It should work just fine at this point. But if I install 4.1.0 on top of that, it will crash on launch:

https://s3.amazonaws.com/shaxpir-installers/install-shaxpir-4.1.0.pkg

But if I uninstall 4.0.0 before installing 4.1.0, then it will work correctly.

I download 4.0.0 pkg and install it on Mac(10.11.6, no existing app folder /Applications/Shaxpir.app before installation), The first time fails, it fails to start and see the errors in the console:

$ /Applications/Shaxpir.app/Contents/MacOS/Shaxpir
[0412/105215.449382:FATAL:chrome_main_delegate.cc(792)] Check failed: !command_line.HasSwitch(switches::kProcessType) && process_type.empty(). Main application forbids --type, saw gpu-process
0   nwjs Framework                      0x000000010b971a73 _ZN2v88UnlockerD1Ev + 15204243
1   nwjs Framework                      0x000000010b98abf7 _ZN2v88UnlockerD1Ev + 15307031
2   nwjs Framework                      0x000000010a095bc3 ChromeMain + 3539
3   nwjs Framework                      0x000000010a095cd4 ChromeMain + 3812
4   nwjs Framework                      0x000000010b5a6d42 _ZN2v88UnlockerD1Ev + 11227746
5   nwjs Framework                      0x000000010b5a639e _ZN2v88UnlockerD1Ev + 11225278
6   nwjs Framework                      0x000000010a094e3b ChromeMain + 75
7   Shaxpir                             0x0000000109e2bdaa main + 522
8   libdyld.dylib                       0x00007fff936445ad start + 1

[19007:39171:0412/105215.542667:ERROR:browser_gpu_channel_host_factory.cc(113)] Failed to launch GPU process.
[19007:39171:0412/105215.542748:ERROR:browser_gpu_channel_host_factory.cc(113)] Failed to launch GPU process.
[19007:39171:0412/105215.542859:ERROR:browser_gpu_channel_host_factory.cc(113)] Failed to launch GPU process.
[19007:39171:0412/105215.542993:ERROR:browser_gpu_channel_host_factory.cc(113)] Failed to launch GPU process.
[19007:39171:0412/105215.543051:ERROR:browser_gpu_channel_host_factory.cc(113)] Failed to launch GPU process.
[0412/105215.543812:FATAL:chrome_main_delegate.cc(792)] Check failed: !command_line.HasSwitch(switches::kProcessType) && process_type.empty(). Main application forbids --type, saw renderer
0   nwjs Framework                      0x00000001045e6a73 _ZN2v88UnlockerD1Ev + 15204243
1   nwjs Framework                      0x00000001045ffbf7 _ZN2v88UnlockerD1Ev + 15307031
2   nwjs Framework                      0x0000000102d0abc3 ChromeMain + 3539
3   nwjs Framework                      0x0000000102d0acd4 ChromeMain + 3812
4   nwjs Framework                      0x000000010421bd42 _ZN2v88UnlockerD1Ev + 11227746
5   nwjs Framework                      0x000000010421b39e _ZN2v88UnlockerD1Ev + 11225278
6   nwjs Framework                      0x0000000102d09e3b ChromeMain + 75
7   Shaxpir                             0x0000000102aa0daa main + 522
8   libdyld.dylib                       0x00007fff936445ad start + 1
9   ???                                 0x0000000000000017 0x0 + 23

@Christywl thanks. could you please check just using the JS code of the app with the official binary? In this way we can rule out the issue of code signing.

Mac version is packaged with a main app bundle and a helper app bundle. Please make sure LSUIElement for the helper bundle is positive value.

Hi @rogerwang, currently I still don't understand which nw.js version, built in normal flavor with nwbuild, is compatible with v0.19.5-mas-beta python script. Can you explain this? Can we have a compatibility table between mas scripts and NW.JS versions? What is the difference between the NW.JS version included in the mas zip file and the official 0.19.5? Thanks.

What's nwbuild? It's not official tool. You might want to ask its
maintainer for that.

On Thu, Apr 13, 2017, 5:49 PM robertocappa notifications@github.com wrote:

Hi rogerwang, currently I still don't understand which nw.js version,
built in normal flawor with nwbuild, is compatible with v0.19.5-mas-beta
python script. Can you explain this? Can we have a compatibility table
between mas scripts and NW.JS versions? Thanks.

—
You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub
https://github.com/nwjs/nw.js/issues/5825#issuecomment-293844208, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAKGGTFgweXlvF69FCwqDVvqzt9g3bTEks5rve-jgaJpZM4Mw7pg
.

http://docs.nwjs.io/en/latest/For%20Users/Advanced/Support%20for%20Mac%20App%20Store/
Download NW.js MAS build from nwjs.io and build your app as described in Package and Distribute -->

http://docs.nwjs.io/en/latest/For%20Users/Package%20and%20Distribute/
You can use following tools to automatically package your NW.js based app for distribution.
nwjs-builder-phoenix
nw-builder
Or your can build your app manually with the instructions below.


As documented, I'm using an unofficial tool because it doesn't exist an official tool!!! The only official way is to manually copy files inside the .app folder, but also in this way the 0.21 mac version don't start after signing using the .py script included in v0.19.5-mas-beta.

@robertocappa please don't hijack this issue thread for your issue. You can file another issue or start discussion in the mailing list.

YOU have merged (and closed) my issue with this one, six hours ago!!!!

I know, but the issue you were talking about in previous comments are not related to both of the issues. Let's keep this thread clear and focus on the real cause.

@robertocappa to be clear, the issue you were talking about in previous comments is about the build/signing tool (which should be another separate issue I suggest), while this issue and #5791 is about the crash we need to fix.

@benjismith , could you please provide your sample without code-signing for me to check?

@benjismith , these non-signed installers also crash on my Mac, do they work fine in your environment?

Hi @Christywl! Both of these installers work for me, but only if no previous Shaxpir installation exists. If there's already another Shaxpir installation, and the new installer overwrites the first installation, then the app will always crash.

At that point, the user can delete the existing installation, and then run the installer again, and everything will work correctly. But it's very frustrating for users to have to uninstall before upgrading...

I'd like a user to be able to update their installation without having to uninstall first, but I can't figure out how to do that, because I don't really understand the nature of this crash. I thought if I sought help understanding the nature of the crash, then I'd be able to fix the installer.

At first, I thought it might be a problem with code-signing, but that doesn't seem to be the case.

Is there anything else I can do to help with the research into this issue? I have a release ready to ship, as soon as this Mac OS installer issue is resolved, so I'd love to help expedite the progress any way possible :)

@rogerwang The signed script from nwjs-mas-v0.19.5-osx-x64.zip doesn't sign official nw20/nw21 that is not built with MAS as @ghostoy said, could you build MAS version with nw21 to verify this issue?

@benjismith I installed the 4.0.0 pkg you provided in a system which doesn't have any previous versions of your app. And it failed to start. I found that at least the helper application is missing in the installation: Contents/Versions/n.n.n.n/nwjs Helper.app. So it should be an issue in your packaging process.

@rogerwang That's weird... I don't see the same problem when I run the installer. The helper is app is right there where I expect it to be...

screen shot 2017-04-20 at 10 06 18 am

This is what I got:
$ ls /Applications/Shaxpir.app/Contents/Versions/57.0.2987.98/ nwjs Framework.framework

Actually, @rogerwang, I think you did reproduce the bug... For some reason, the PKG installer isn't being built correctly (no helper app!) and therefore it crashes on first launch.

The reason I filed this bug is because there's no reliable tooling for building and signing a PKG installer of a NWJS app for Macintosh, so I cobbled together a build script the best I could... And it seemed to work pretty well for a year, only to stop working recently (with 0.21.4). But I don't know why it stopped working... Has something changed recently in the internal NWJS directory structure on Mac?

I tried referring to the Support for Mac App Store instructions, but they seem to be out of date.

Incidentally, it would be nice to have future build scripts written in Javascript (rather than python) since JS is a more natural fit for the skillsets of people using NWJS in the first place...

@benjismith could you share your tool that working ?...

close since it's an issue in the package tool from user.

@benjismith it could be a change in the directory structure of the framework bundle, which now is versioned and being referred to by a symlink.

@rogerwang but I have exactly same issue with nw builder and nw version 21+ :( And no one can't help me 2 month :(

@Arti3DPlayer is that an issue of nw builder?

@rogerwang https://github.com/nwjs/nw.js/issues/5874 I guess no, I tried different builders, and build manually. Nothing work. I guess it is incorrect nw.js structure:( Something with symlinks or frameworks.

Was this page helpful?
0 / 5 - 0 ratings