[3.0.2] Breakpoints do not stop on any simplest Node.js express app

I have run and debug node.js application without any problems.
However, when I start using express.js on top of node.js, the breakpoints I set for debugging do not work.

While debugging, the break stops at fs.js even though no breaks exits, and so the app hangs there.
So, I followed this post http://devnet.jetbrains.net/thread/433875?tstart=0 to turn off "all exceptions."

After turning off "all exceptions", although the node.js Express app ran well, Webstorm never stopped on any breakpoints I set for the app.

So I ran an experiement with the follow two cases:

Case 1: Simple express app, ran well but breakpoints won't work while debugging.

var express = require('express'),
app = express.createServer();
app.use(express.bodyParser());
app.post('/', function(req, res) {
     res.send(req.body);
});
app.listen(3000);




Case 2: Wrap express inside node.js createServer. Ran well and debugging works at breakpoints.

var express = require('express'),
    app = express.createServer();

var http = require('http');
http.createServer(function (req, res) {
    app.use(express.bodyParser());
    app.post('/', function(req, res) {
        res.send(req.body);
    });
}).listen(3000, "127.0.0.1");



Does anyone know why? Thanks

I am running:
     Webstorm: 3.0.2
     Node.js: 0.6.10
     Express: 2.5.8

7 comments
Comment actions Permalink

Case 1 source code should be here:

var express = require('express'),
app = express.createServer();

app.use(express.bodyParser());
app.post('/', function(req, res) {
    res.send(req.body);
});
//app.listen(3000);


0
Comment actions Permalink

It's not just Express.
It seems like debugger does not know where the source of Express is.

I have tried another module by require('module_name'), and debugger does not stop on any breakpoints either.

Is this a problem with Webstorm which does not know "require" so that the debugger cannot stop on the module's breakpoints?


0
Comment actions Permalink

I found the same thing with v3.0.2 with one disturbing twist:  breakpoints using nodejs *DO* work intermittently after doing some http get transact ions using the http built-in module.  

So it does appear that webstorm CAN find the source locations intermittently.    But the simplest breakpoints in the simplest "helloworld" module do not work. Unfortunately this *DID* work before Feb 15  when I did updates on ubuntu including webstorm. Downloading earlier versions of webstorm (v3.0 and 3.0.1)  did not help ... so it appears NOT to be a webstorm issue but instead something else.

I am running node v0.6.10 which updated yesterday on ubuntu 10.04 LTS.

Any help from jetbrains would be very much appreciated.

0
Comment actions Permalink

Some java exceptions that may give jetbrains a clue. They occur while trying to debug.

Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
Feb 16, 2012 12:43:43 PM org.chromium.sdk.internal.transport.SocketConnection$3 shutdown
INFO: Shutdown requested
[  31542]  ERROR - plication.impl.ApplicationImpl - Exception occured in callback
java.lang.RuntimeException: Exception occured in callback
 at org.chromium.sdk.CallbackSemaphore.tryAcquire(CallbackSemaphore.java:68)
 at org.chromium.sdk.CallbackSemaphore.tryAcquireDefault(CallbackSemaphore.java:33)
 at org.chromium.sdk.internal.v8native.JavascriptVmImpl.getScripts(JavascriptVmImpl.java:40)
 at com.intellij.chromeConnector.debugger.LoadScriptsRequest.process(LoadScriptsRequest.java:25)
 at com.intellij.chromeConnector.connection.impl.V8ConnectionImpl.processRequests(V8ConnectionImpl.java:87)
 at com.intellij.chromeConnector.connection.impl.V8ConnectionImpl.access$200(V8ConnectionImpl.java:25)
 at com.intellij.chromeConnector.connection.impl.V8ConnectionImpl$1.run(V8ConnectionImpl.java:129)
 at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:425)
 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
 at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:140)
Caused by: java.lang.Exception: Exception saved from callback
 at org.chromium.sdk.CallbackSemaphore.callbackDone(CallbackSemaphore.java:80)
 at org.chromium.sdk.util.RelaySyncCallback$Guard$1.callbackDone(RelaySyncCallback.java:83)
 at org.chromium.sdk.util.AsyncFuture$Working.resultIsReadySync(AsyncFuture.java:318)
 at org.chromium.sdk.util.AsyncFuture$Working.access$1(AsyncFuture.java:311)
 at org.chromium.sdk.util.AsyncFuture$Working$3.callbackDone(AsyncFuture.java:243)
 at org.chromium.sdk.internal.BaseCommandProcessor.callThemBack(BaseCommandProcessor.java:141)
 at org.chromium.sdk.internal.BaseCommandProcessor.processIncoming(BaseCommandProcessor.java:104)
 at org.chromium.sdk.internal.v8native.V8CommandProcessor.processIncomingJson(V8CommandProcessor.java:113)
 at org.chromium.sdk.internal.standalonev8.StandaloneVmImpl$4.messageReceived(StandaloneVmImpl.java:115)
 at org.chromium.sdk.internal.transport.SocketConnection$RegularMessageItem.report(SocketConnection.java:120)
 at org.chromium.sdk.internal.transport.SocketConnection$ResponseDispatcherThread.run(SocketConnection.java:209)
Caused by: java.lang.IllegalStateException: Connection is closed
 at org.chromium.sdk.internal.transport.SocketConnection.runInDispatchThread(SocketConnection.java:328)
 at org.chromium.sdk.internal.standalonev8.StandaloneVmImpl$V8CommandOutputImpl.runInDispatchThread(StandaloneVmImpl.java:252)
 at org.chromium.sdk.internal.v8native.V8CommandProcessor.runInDispatchThread(V8CommandProcessor.java:101)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy.getAllScriptsAsync(DebugSession.java:213)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy.access$1(DebugSession.java:210)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$1.done(DebugSession.java:201)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$1.done(DebugSession.java:1)
 at org.chromium.sdk.util.AsyncFuture$Working.resultIsReady(AsyncFuture.java:306)
 at org.chromium.sdk.util.AsyncFuture$Working.access$0(AsyncFuture.java:294)
 at org.chromium.sdk.util.AsyncFuture$Working$2.done(AsyncFuture.java:237)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$ScriptsRequester$1.success(DebugSession.java:230)
 at org.chromium.sdk.internal.v8native.V8Helper$1.success(V8Helper.java:107)
 at org.chromium.sdk.internal.v8native.V8CommandCallbackBase.messageReceived(V8CommandCallbackBase.java:25)
 at org.chromium.sdk.internal.v8native.V8CommandCallbackBase.messageReceived(V8CommandCallbackBase.java:1)
 at org.chromium.sdk.internal.BaseCommandProcessor$3.call(BaseCommandProcessor.java:100)
 at org.chromium.sdk.internal.BaseCommandProcessor$3.call(BaseCommandProcessor.java:1)
 at org.chromium.sdk.internal.BaseCommandProcessor.callThemBack(BaseCommandProcessor.java:134)
 ... 5 more
[  31550]  ERROR - plication.impl.ApplicationImpl - JetBrains WebStorm 3.0.2  Build #WS-111.296
[  31550]  ERROR - plication.impl.ApplicationImpl - JDK: 1.6.0_31
[  31550]  ERROR - plication.impl.ApplicationImpl - VM: Java HotSpot(TM) 64-Bit Server VM
[  31550]  ERROR - plication.impl.ApplicationImpl - Vendor: Sun Microsystems Inc.
[  31551]  ERROR - plication.impl.ApplicationImpl - OS: Linux
[  31551]  ERROR - plication.impl.ApplicationImpl - Last Action: Debug
Feb 16, 2012 12:43:43 PM org.chromium.sdk.internal.BaseCommandProcessor processIncoming
SEVERE: Failed to dispatch response to callback
java.lang.IllegalStateException: Connection is closed
 at org.chromium.sdk.internal.transport.SocketConnection.runInDispatchThread(SocketConnection.java:328)
 at org.chromium.sdk.internal.standalonev8.StandaloneVmImpl$V8CommandOutputImpl.runInDispatchThread(StandaloneVmImpl.java:252)
 at org.chromium.sdk.internal.v8native.V8CommandProcessor.runInDispatchThread(V8CommandProcessor.java:101)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy.getAllScriptsAsync(DebugSession.java:213)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy.access$1(DebugSession.java:210)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$1.done(DebugSession.java:201)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$1.done(DebugSession.java:1)
 at org.chromium.sdk.util.AsyncFuture$Working.resultIsReady(AsyncFuture.java:306)
 at org.chromium.sdk.util.AsyncFuture$Working.access$0(AsyncFuture.java:294)
 at org.chromium.sdk.util.AsyncFuture$Working$2.done(AsyncFuture.java:237)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$ScriptsRequester$1.success(DebugSession.java:230)
 at org.chromium.sdk.internal.v8native.V8Helper$1.success(V8Helper.java:107)
 at org.chromium.sdk.internal.v8native.V8CommandCallbackBase.messageReceived(V8CommandCallbackBase.java:25)
 at org.chromium.sdk.internal.v8native.V8CommandCallbackBase.messageReceived(V8CommandCallbackBase.java:1)
 at org.chromium.sdk.internal.BaseCommandProcessor$3.call(BaseCommandProcessor.java:100)
 at org.chromium.sdk.internal.BaseCommandProcessor$3.call(BaseCommandProcessor.java:1)
 at org.chromium.sdk.internal.BaseCommandProcessor.callThemBack(BaseCommandProcessor.java:134)
 at org.chromium.sdk.internal.BaseCommandProcessor.processIncoming(BaseCommandProcessor.java:104)
 at org.chromium.sdk.internal.v8native.V8CommandProcessor.processIncomingJson(V8CommandProcessor.java:113)
 at org.chromium.sdk.internal.standalonev8.StandaloneVmImpl$4.messageReceived(StandaloneVmImpl.java:115)
 at org.chromium.sdk.internal.transport.SocketConnection$RegularMessageItem.report(SocketConnection.java:120)
 at org.chromium.sdk.internal.transport.SocketConnection$ResponseDispatcherThread.run(SocketConnection.java:209)
[  31551]  ERROR - plication.impl.ApplicationImpl - Original exception:  
java.lang.Exception: Exception saved from callback
 at org.chromium.sdk.CallbackSemaphore.callbackDone(CallbackSemaphore.java:80)
 at org.chromium.sdk.util.RelaySyncCallback$Guard$1.callbackDone(RelaySyncCallback.java:83)
 at org.chromium.sdk.util.AsyncFuture$Working.resultIsReadySync(AsyncFuture.java:318)
 at org.chromium.sdk.util.AsyncFuture$Working.access$1(AsyncFuture.java:311)
 at org.chromium.sdk.util.AsyncFuture$Working$3.callbackDone(AsyncFuture.java:243)
 at org.chromium.sdk.internal.BaseCommandProcessor.callThemBack(BaseCommandProcessor.java:141)
 at org.chromium.sdk.internal.BaseCommandProcessor.processIncoming(BaseCommandProcessor.java:104)
 at org.chromium.sdk.internal.v8native.V8CommandProcessor.processIncomingJson(V8CommandProcessor.java:113)
 at org.chromium.sdk.internal.standalonev8.StandaloneVmImpl$4.messageReceived(StandaloneVmImpl.java:115)
 at org.chromium.sdk.internal.transport.SocketConnection$RegularMessageItem.report(SocketConnection.java:120)
 at org.chromium.sdk.internal.transport.SocketConnection$ResponseDispatcherThread.run(SocketConnection.java:209)
Caused by: java.lang.IllegalStateException: Connection is closed
 at org.chromium.sdk.internal.transport.SocketConnection.runInDispatchThread(SocketConnection.java:328)
 at org.chromium.sdk.internal.standalonev8.StandaloneVmImpl$V8CommandOutputImpl.runInDispatchThread(StandaloneVmImpl.java:252)
 at org.chromium.sdk.internal.v8native.V8CommandProcessor.runInDispatchThread(V8CommandProcessor.java:101)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy.getAllScriptsAsync(DebugSession.java:213)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy.access$1(DebugSession.java:210)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$1.done(DebugSession.java:201)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$1.done(DebugSession.java:1)
 at org.chromium.sdk.util.AsyncFuture$Working.resultIsReady(AsyncFuture.java:306)
 at org.chromium.sdk.util.AsyncFuture$Working.access$0(AsyncFuture.java:294)
 at org.chromium.sdk.util.AsyncFuture$Working$2.done(AsyncFuture.java:237)
 at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$ScriptsRequester$1.success(DebugSession.java:230)
 at org.chromium.sdk.internal.v8native.V8Helper$1.success(V8Helper.java:107)
 at org.chromium.sdk.internal.v8native.V8CommandCallbackBase.messageReceived(V8CommandCallbackBase.java:25)
 at org.chromium.sdk.internal.v8native.V8CommandCallbackBase.messageReceived(V8CommandCallbackBase.java:1)
 at org.chromium.sdk.internal.BaseCommandProcessor$3.call(BaseCommandProcessor.java:100)
 at org.chromium.sdk.internal.BaseCommandProcessor$3.call(BaseCommandProcessor.java:1)
 at org.chromium.sdk.internal.BaseCommandProcessor.callThemBack(BaseCommandProcessor.java:134)
 ... 5 more

0
Comment actions Permalink

I can repeatedly prove taht the source of the problem is not Webstorm v3.0.2 but node.js version 6.10.  The former was released on Feb 12, 2012 and the latter was released on  Feb 4, 2012!  Thus it is easy after doing a full set of software updates to mis-BLAME webstorm especially since  webstorm v3.0.1 and 3.0  did not suffer from this breakpoint silence. But these  were released before node js v0.6.10!  I re-download and installed webstorm 3.0.1 and 3.0 and they encounter the same breakpoint bug.


The bug disappears if you revert to version 6.8 of node js.  Webstorm 3.0.2 works fine with this.

So how does one go back to an earlier version of node js?

On ubuntu linux I  use the nvm script and issue these commands:

nvm install v0.6.8
nvm use v0.6.8

To  get and use the nvm script, follow the guidelines recorded at  https://github.com/creationix/nvm

This will deposit the script in the .nvm sub folder.  You source if from your shell with the command
.~/.nvm/nvm.sh

You ALSO need to re-configure your webstorm run/debug settings so that it uses this version of node js.   The "Path to Node" field in the settings window must be set to the location where nvm maintains the 6.8 version of node js.  For me this location is

/home/strangeloop/.nvm/v0.6.8/bin/node


NOTE:  Every time you start a new terminal shell you must revert to the working version of node with the command

nvm use v0.6.8

When launching webstorm from  a different shell for from the GUI menus you do NOT need to invoke this command.  Rather you simply need to put the 6.8 location of node into your webstorm debug/run settings for the "Path to Node".


The other main dependency to make sure that you are using with webstorm  *IF* you are using a debian linux do NOT use OpenJDK.  Use Oracle JAVA.  To integrate with apt-get consult the repository described at http://www.duinsoft.nl/packages.php?t=en

0
Comment actions Permalink

Looks like it isn't related to modules. Sometimes the code is executed before debugger can register the breakpoints so breakpoints works only in callback functions but not in the main body. May be it is indeed caused by some bug in node 0.6.10.

0
Comment actions Permalink

I am having the same issue.  I am able to debug only callbacks when sending requests using the express "app.get()" API.

I believe Stephen is right. It does seem to be a NodeJS issue as I was able to debug everything before upgrading to 0.6.10.

However, I just updated to 0.6.11 and debugging within WebStorm is working successfully. I hope that helps everyone.

0

Please sign in to leave a comment.