Node: In "node debug" in a certain reproducible scenario, typing "c" twice causes node to completley hang

Created on 12 Jan 2016  Â·  11Comments  Â·  Source: nodejs/node

Please see the reproducing test case here: https://github.com/shlomif/node-js-bug--debug-gets-stuck-on-two-c-commands namely doing:

shlomif@telaviv1:~/node-js-debug-gets-stuck-on-two-c$ /home/shlomif/apps/node-js/bin/node debug perlito5.js -I src5/lib -I MyDir/lib -I MyDir/lib/expand-solitaire-multi-card-moves 
< Debugger listening on port 5858
connecting to 127.0.0.1:5858 ... ok
break in perlito5.js:20
 18 // See http://www.perl.com/perl/misc/Artistic.html
 19 
>20 "use strict";
 21 var isNode = typeof require != "undefined";
 22 
debug> c
debug> c

Causes the debugger to hang without being able to interrupt using either ctrl+c or ctrl+z. I'm using node-v5.4.0 on Mageia Linux x86-64 v6. More info can be found in the link.

debugger

Most helpful comment

FWIW, Node.js 8.0.0-pre gives sensible feedback about what is going on here and does not hang.

$ ./node debug perlito.js 
(node:90329) [DEP0068] DeprecationWarning: `node debug` is deprecated. Please use `node inspect` instead.
< Debugger listening on 127.0.0.1:9229.
< To start debugging, open the following URL in Chrome:
<     chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/81a56490-14d3-488b-a726-537da2df7e3a
< Debugger attached.
Break on start in perlito.js:1
> 1 (function (exports, require, module, __filename, __dirname) { 
  2 "use strict";
  3 var isNode = typeof require != "undefined";
debug> c
< Waiting for the debugger to disconnect...
debug> c
Error: Use `run` to start the app again.
    at Promise (node-inspect/lib/internal/inspect_client.js:238:16)
    at Promise (<anonymous>)
    at Client.callMethod (node-inspect/lib/internal/inspect_client.js:236:12)
    at Proxy.callVirtualMethod (node-inspect/lib/_inspect.js:140:23)
    at Object.get cont [as cont] (node-inspect/lib/internal/inspect_repl.js:852:25)
    at repl:1:1
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at Object.runInContext (vm.js:108:6)
    at REPLServer.controlEval (node-inspect/lib/internal/inspect_repl.js:521:25)
    at bound (domain.js:301:14)
debug>

First c goes to the end of the program. Next c is an error because the program has already terminated.

Node.js 8.0.0 is expected to be released mid- or late May.

All 11 comments

I am unsure if this is a node debugger issue as opening perlito5.js hangs my node process itself.
Also, it is quite hard to pin point the issue as perlito5.js is >43k loc. :s

I am having the same behaviour in a closed-source project. my project is not so big (although it depends in express and other small libraries).

It's _possible_ this is related to https://github.com/nodejs/node/pull/4819

I have removd all unrelated sources and reduced perlito5.js to a couple of lines and the bug is still reproducible. Please download the reduced version from my fork:

https://github.com/nacho4d/node-js-bug--debug-gets-stuck-on-two-c-commands

Just run:

node debug perlito5.js

I don't know if what I did is enough but I pulled the branch from #4819 and compiled and tried with that node version. I still see the same behaviour :(

I can do c++ but in this case I don't know where to start. If somebody can give me some pointers maybe I can look at this?

@nacho4d : thanks for your help and insights! I can reproduce the problem with your two lines-long program as well here (node-5.4.0 built from source on Mageia x86-64 cauldron).

FWIW, Node.js 8.0.0-pre gives sensible feedback about what is going on here and does not hang.

$ ./node debug perlito.js 
(node:90329) [DEP0068] DeprecationWarning: `node debug` is deprecated. Please use `node inspect` instead.
< Debugger listening on 127.0.0.1:9229.
< To start debugging, open the following URL in Chrome:
<     chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/81a56490-14d3-488b-a726-537da2df7e3a
< Debugger attached.
Break on start in perlito.js:1
> 1 (function (exports, require, module, __filename, __dirname) { 
  2 "use strict";
  3 var isNode = typeof require != "undefined";
debug> c
< Waiting for the debugger to disconnect...
debug> c
Error: Use `run` to start the app again.
    at Promise (node-inspect/lib/internal/inspect_client.js:238:16)
    at Promise (<anonymous>)
    at Client.callMethod (node-inspect/lib/internal/inspect_client.js:236:12)
    at Proxy.callVirtualMethod (node-inspect/lib/_inspect.js:140:23)
    at Object.get cont [as cont] (node-inspect/lib/internal/inspect_repl.js:852:25)
    at repl:1:1
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at Object.runInContext (vm.js:108:6)
    at REPLServer.controlEval (node-inspect/lib/internal/inspect_repl.js:521:25)
    at bound (domain.js:301:14)
debug>

First c goes to the end of the program. Next c is an error because the program has already terminated.

Node.js 8.0.0 is expected to be released mid- or late May.

This is unlikely to be fixed in older versions and the debugger is now removed in newer versions. Closing. We can reopen if necessary

On Mon, 29 May 2017 21:27:33 -0700
James M Snell notifications@github.com wrote:

This is unlikely to be fixed in older versions and the debugger is now
removed in newer versions. Closing. We can reopen if necessary

Hi!

Just a question - what can I use now instead of the removed debugger?

-- @shlomif

--

Shlomi Fish http://www.shlomifish.org/
Perl Humour - http://perl-begin.org/humour/

It always works at the end. Too bad it doesn't work right at the beginning.
— Shlomi Fish’s relative.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

@shlomif You can use node inspect script.js instead. The commands are the same. It just uses the V8 inspector instead of the old debugger.

On Tue, 30 May 2017 00:53:06 -0700
Michaël Zasso notifications@github.com wrote:

@shlomif You can use node inspect script.js instead. The commands are the
same. It just uses the V8 inspector instead of the old debugger.

Thanks for the info, Michael!

--

Shlomi Fish http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/facts/Summer-Glau/

Chuck Norris makes sure his ciphers are unbreakable by killing all the crypto
experts that could possibly break them.
— http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danialkhansari picture danialkhansari  Â·  3Comments

willnwhite picture willnwhite  Â·  3Comments

vsemozhetbyt picture vsemozhetbyt  Â·  3Comments

loretoparisi picture loretoparisi  Â·  3Comments

fanjunzhi picture fanjunzhi  Â·  3Comments