util.inspect({level: "info"}) exits the debug session
When debugging in node.js 5.3.0 the script bug.js
var util = require('util');
util.inspect({level: "info "});
console.log("Test");
with node debug bug.js, the debugging session exits. I tried the same in node.js 4.2.4 and it doesn't. When debugging the difference in lib/util.js, line 324 in 5.3.0 looks like this:
var promiseInternals = inspectPromise(value);
and line 319 in 4.2.4 looks like:
var promiseInternals = value instanceof Promise && inspectPromise(value);
As value is not an instance of Promise, inspectPromise(value) is called in 5.3.0. Then inspectPromise calls ensureDebugIsInitialized() which on the other hand calls require('vm').runInDebugContext('Debug'). This causes the debugging session to exit. The issue was tested in Ubuntu 14.04 LTS.
I have no idea either offhand what the change was. You could git bisect it I suppose.
i'm experiencing this issue when debugging my expressjs application via node-debug (node 5.4.1)
express logs a value, the formatter tries to inspect the value via inspectPromise, which calls ensureDebugIsInitialized and my debugging session is gone
any workarounds?
I also experienced this problem on Windows 10. Downgrading to Node 4.2.4 (and then installing the latest NPM to avoid MAX_PATH issues) worked around the issue for me.
I bet this is the same problem we are seeing in #4815
From what I've been able to investigate @TheAlphaNerd ... I tend to agree.
Just to confirm I have experienced exactly same behaviour (node 4.2.6) as @AdamAndersonFalafelSoftware. Tested in NTVS and Visual studio code.
I have a similar problem using Node (4.2.6) under OSX (10.10.5).
If I use WebStorm to debug, the process silently exits with code 139.
If I run the app through bash with the --debug flag it throws "Segmentation fault: 11" and exits.
In production everything works fine.
Thanks!
I'm seeing this exact behavior as well on Node 4.2.6 on Windows, via the azure-storage package.
@pprice Downgrade to 4.2.4. As I reported above, the debugger works at that version
I can confirm the issue is resolved by downgrading to 4.2.4.
Sadly downgrading is not an option for everyone.
Downgrade worked - thanks @AdamAndersonFalafelSoftware. I can also confirm for OSX 10.11. I'm hoping 4.2.8 will have the fix? Bit of pain telling coworkers they have to use a specific version to debug.
Similar behavior described by @imaustink with Webstorm under OS X with 4.2.6. Node 4.2.2 is working OK.
There is a fix in, hoping to have it released for ya'll soon after the next security release
https://github.com/nodejs/node/pull/4819
Thanks @TheAlphaNerd!
In the mean time, for folks stumbling upon this, I can confirm that downgrading to 4.2.4 resolves this for folks seeing issues in their Sails apps (thanks @chirag200666 and @LongSteve!)
The fix is now in master, you should expect this to see it in a release in the next 2 - 3 weeks on v4 and v5.
Thanks for your efforts @TheAlphaNerd it is greatly appreciated.
The fix is now released in v5.6.0. Expect LTS next week
Still broken in 4.3.0 with the following code in WebStorm 11.03 debug
var jsonData = jsonfile.readFileSync(fromFile);
log.trace(jsonData);
The trace (or info levels etc) is dumped, but the debug session is exited afterwards.
The comment just above yours mentioned already that it will be fixed at a later time for LTS.