Starting Node.js Web Server in Debug Mode is Very Slow

Starting my Node.js server in debug mode has become very slow, to the point of being almost unusable.

Currently my Node.js server process takes about 11 seconds to start in debug. That is a big improvement in relationship with some of the earlier builds of version 6 which could take up to 20 seconds. But it compares badly with a second when I startit from the command line or simply hit "run" from WebStorm. The same project opened with WebStorm 5 only takes 4 seconds to start in debug. In all this cases, it is always the same project with the same code.

The startup sequence is quite straightforward: I load express (with some routes), connect to mongodb and redis and wait for connections. Nothing fancy.

I have increased my vm options to make sure that it is not memory starved, but I haven't seen any improvements. Any ideas?


Thanks
Angel

16 comments

I have the same problem, in WebStorm 5 the debugger would take maybe 30 seconds for my project to startup and be ready to debug for node.js, in WebStorm 6 I haven't timed it, but it's long enough to go take a nap, go to the bathroom, get a coffee and it's finally started.

I'll have to go back to WebStorm 5 until this is resolved,
thanks,
-Matt

0

One possible cause of this is the JetBrains Chrome Extension,
I didn't have it installed before I upgraded to WebStorm 6, now, even after I've gone back to using WebStorm 5, my debugging is very slow, I've even uninstalled the Chrome Extension and I have the same problem.

Please Help!

-Matt

0

More information: My co-worker is using WebStorm 6, same project and his
debugging is fine (just as it was in WebStorm 5), he thought he used to have the Chrome Extension installed, but when we looked, he doesn't have it installed anymore.

I can't seem to figure this out, I've switched back to version 6 and I'm still having the problem.

0

How long does it take for debug mode from the command line (without WebStorm) to start for you?

For example, in your project directory, try
node debug app.js

0

When I run node debug app.js it works great, maybe takes 10 seconds to start showing the log messages I expect and it breaks on the first line of app.js.

If I run the command that webstorm says it's running:
node --debug-brk=54854 app.js

It hangs forever just like in webstorm.

thanks for your help,
-Matt

0

One note:
if I start on the command line with: node --debug-brk=56986 server.js

and then open my browser to:
http://127.0.0.1:56986

then the debugger process wakes up or stops hanging and I see my console messages.

Perhaps there is something similar going on when I debug through webstorm where it is waiting for the connection from the chrome extension?

-Matt

0

Another Interesting thing to Note:
When I debug a simple node file through WebStorm (a mocha test debugging harness) instead of the main app.js which uses express/connect, etc...  It starts up and runs through, but it doesn't break on my breakpoints that I set at all!

This is on Mac OS X, I've tried different versions of node as well, 0.6.19 and 0.8.20, same issue.

-Matt

0

I was able to get the breakpoints working in my small (mocha test) configuration.   I think the key was by upgrading the nodejs plugin within webstorm.

After that was working, I noticed that in my larger project (with express, etc...) if I startup with the option of "break on all exceptions" I see it breaks immediately.  I tried this because I noticed this bug:
http://youtrack.jetbrains.com/issue/WEB-1917
mentions that breaking on all exceptions shows breakpoints.

Screen Shot 2013-03-09 at 11.55.58 AM.png

As I step through after "Breaking on all exceptions" it hits the fs.js file under frames in the debugger tab (as shown in the screenshot) and the path shows it hitting this exception for just about every node_module.

This could explain why it's taking forever to startup the debugging if it's hitting exceptions for whatever reason in every one of my node modules.

Hope this helps get the the bottom of the issue.  I'd rather not have to rebuild my whole machine to get the debugging working correctly again in WebStorm.


thanks,
-Matt

0

We are investigating this problem. About JB IDE support extension — we use it only for browser debug, extension is not needed for Node JS.

0

Any updates on this issue?

My coworker had tested his debugger again and notified me that it was broken (super slow) for him as well.  I suspect it may be caused or made worse by some recent node_module put into our repository, I tried removing some of the more recently added modules though and it didn't help, so it's still a mystery to me.

thanks,
-Matt

0

I hope it was fixed in WebStorm 6.0.2 (coming soon)/IntelliJ IDEA 12.1.

0

Thank you!

This will really make a HUGE difference in my day to day work. I have to restart the server a many, many times each day (since I tend to make a lot of bugs that I have to debug).

Thanks
Angel

0

I'm evaluating 6.0.2, node 0.10.13 installed

Debug startup is very slow around 25-30 seconds when the app normally starts up in 1-2 seconds.

I believe this has to do with webstorm retrieving a list of all the files loaded in the process, I can see the Script Files list growing progressively larger during this delay.
In this case I have a large number of modules and it must be recursing through the entire lot - slowly.

It's way too slow to be used on a frequent basis.

Can confirm that startup is snappy with a simple script

 var fs = require('fs'); 

console.log('smoo'); 

setInterval(function () {  },1000); 
0

Thanks - huge improvement in load time.  Look forward to the final release, this EAP has an Expiration Date of 14 September.

0

Please sign in to leave a comment.