jgrenon / angular-desktop-app

This is a simple application skeleton to create desktop application using AngularJS. This application is using node-webkit as our desktop host, bower to install client-side libraries as well as normal npm modules as supported by node-webkit.
MIT License
237 stars 57 forks source link

Node-webkit crashes on startup (Windows 7 x64) #9

Closed talss89 closed 10 years ago

talss89 commented 10 years ago

Hi,

I haven't had chance to look at this issue in detail, but grunt build is failing to run on Windows 7 after pulling a fresh copy of 1.1.0(?)

I get the following terminal output:

OS: win
Running "less:./src/css/app.css" (less) task
File ./src/css/app.css created.

Running "shell:run" (shell) task
[25460:0212/215826:FATAL:render_process_host_impl.cc(420)] Check failed: !g_exit
ed_main_message_loop.

Done, without errors.

Node-webkit fires up to the point at which it renders the page, then exits, resulting in the output above.

In addition, running grunt build, and then running the executable in releases/, takes ages to start (comparatively), then causes the process to become unresponsive.

I've narrowed the issue down to mongoose (3.8.7). I guess the next step would be to see if anything similar has been reported with them.

Commenting out line 7 in src/js/services/db.js. allows node-webkit to boot.

Eg.

        // var mongoose = require('mongoose');

I'm pretty busy at the moment, but will try to have a look further into this later in the week.

Tom.

talss89 commented 10 years ago

I've spotted https://github.com/rogerwang/node-webkit/issues/1006

Zipping and dropping on to executable still does not work however. I don't think it's related.

talss89 commented 10 years ago

Loading mongoose 3.8.7 into a fresh node-webkit 0.8.4 (with no other modules / loaded) results in exactly the same behaviour.

Looks like the issue might be with the mongoose package.

jgrenon commented 10 years ago

thanks for the feedback. I’ll test on Linux and Windows and report any issues back to the node-webkit project.
Are there any errors when you execute npm (npm-debug.log?), sounds like some native code is failing here.

On Wednesday, February 12, 2014 at 17:31, Tom Lawton wrote:

Loading mongoose 3.8.7 into a fresh vanilla node-webkit 0.8.4 results in exactly the same behaviour. Looks like the issue might be with the mongoose package.

— Reply to this email directly or view it on GitHub (https://github.com/jgrenon/angular-desktop-app/issues/9#issuecomment-34926511).

talss89 commented 10 years ago

Hi. Nope, no npm-debug.log is written, and npm install does not throw any errors.

I believe this is a similar issue https://github.com/rogerwang/node-webkit/issues/1174

Compiling mongoose/mongodb/BSON with nw-gyp results in no errors, but node-webkit continues to crash.

In addition, mongoose/mongodb/kerberos uses node-gyp to build. nw-gyp fails to build it on my system. The output is here: https://gist.github.com/talss89/8979776

The kerberos module has a test suite, run via npm test. Needless to say, this fails 2/2 tests.

It could be that my MSVS environment is broken - it's only in use for node-gyp on this machine.

In particular the warning below seems to suggest something fishy going on in the MS toolchain.

warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc 

Joel - It'll be interesting to see if everything is working on your Windows box.

talss89 commented 10 years ago

Ok, here's the fix.

It's a bit of a hassle having to perform this step on every npm install. I don't have much experience with NPM / *-gyp so can't really offer a permanent solution aside from including the above steps in the readme. But that's a last resort IMO.

The kerberos compilation issue turned out to be unrelated (after I'd debugged the linker error and got it to compile ... typical!)

jgrenon commented 10 years ago

ok that’s good. To keep things going while we find a better fix, I’ve added a post-install script in package.json that execute your workaround after each npm install automatically. Let’s keep this script until we find a real solution.

I didn’t have this problem on my Windows btw. The app was very long to start though, which might be another issue. I’ll look into it when I have spare time.

thanks! Joel

On Thursday, February 13, 2014 at 15:12, Tom Lawton wrote:

Ok, here's the fix. CD to src\node_modules\mongoose\node_modules\mongodb\node_modules\bson
Execute nw-gyp clean && nw-gyp configure --target=0.8.4 && nw-gyp build
The app should boot OK.

It's a bit of a hassle having to perform this step on every npm install. I don't have much experience with NPM / *-gyp so can't really offer a permanent solution aside from including the above steps in the readme. But that's a last resort IMO. The kerberos compilation issue turned out to be unrelated (after I'd debugged the linker error and got it to compile ... typical!)

— Reply to this email directly or view it on GitHub (https://github.com/jgrenon/angular-desktop-app/issues/9#issuecomment-35020451).

jgrenon commented 10 years ago

I haven’t test the script on windows… maybe you’ll have to fine-tune a bit to get this running… I’ve used bash she-bang approach which will definitely not run on Windows.

On Thursday, February 13, 2014 at 15:37, Joel Grenon wrote:

ok that’s good. To keep things going while we find a better fix, I’ve added a post-install script in package.json that execute your workaround after each npm install automatically. Let’s keep this script until we find a real solution.

I didn’t have this problem on my Windows btw. The app was very long to start though, which might be another issue. I’ll look into it when I have spare time.

thanks! Joel

On Thursday, February 13, 2014 at 15:12, Tom Lawton wrote:

Ok, here's the fix. CD to src\node_modules\mongoose\node_modules\mongodb\node_modules\bson
Execute nw-gyp clean && nw-gyp configure --target=0.8.4 && nw-gyp build
The app should boot OK.

It's a bit of a hassle having to perform this step on every npm install. I don't have much experience with NPM / *-gyp so can't really offer a permanent solution aside from including the above steps in the readme. But that's a last resort IMO. The kerberos compilation issue turned out to be unrelated (after I'd debugged the linker error and got it to compile ... typical!)

— Reply to this email directly or view it on GitHub (https://github.com/jgrenon/angular-desktop-app/issues/9#issuecomment-35020451).

talss89 commented 10 years ago

Great - thanks! The script executes perfectly, and seems to do exactly what I did earlier to get node-webkit to run.

Unfortunately, the problem is still there as it was.

Anyway, I just applied my patch for kerberos to your updated master, ran nw-gyp over that, copied the bson.node binary into ext/ and node-webkit is back.

I've managed to pull 3 fresh copies and use the following process to get them working, so I'm assuming this is the actual fix end to end:

I'm not sure on the differences between node-gyp and nw-gyp, but node-gyp compiles the unmodified kerberos source (0.0.3) fine, whereas nw-gyp does not, and cries about a linker error.

The linker error is being caused by the V8 headers being included twice. Something in the difference between node-gyp and nw-gyp is causing two copies of the headers being linked. Usually I would think this is because the header guards can't take into account #defines from other objects, which may or may not be linked, but I expected the behaviour to be the same between nw-gyp and node-gyp. Which has left me scratching my head.

talss89 commented 10 years ago

Sorry to keep posting - but just realised two things: a) this is a nw-gyp / kerberos issue and better off raised with them (duh...) and b) The V8 header linker problem is due to node-webkit using a modified version of the V8 headers.

It's late, so I'll raise this tomorrow with nw-gyp or mongodb/kerberos.

Thanks,

Tom.