Skip to content

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

Description

@shlomif

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.

Activity

  1. zeusdeux commented on Jan 12, 2016

    @zeusdeux
    Contributor

    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

  2. nacho4d commented on Jan 23, 2016

    @nacho4d

    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).

  3. jasnell commented on Jan 23, 2016

    @jasnell
    Member

    It's possible this is related to #4819

  4. nacho4d commented on Jan 23, 2016

    @nacho4d

    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
    
  5. nacho4d commented on Jan 23, 2016

    @nacho4d

    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?

  6. shlomif commented on Jan 23, 2016

    @shlomif
    Author

    @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).

  7. Trott commented on Apr 23, 2017

    @Trott
    Member

    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.

  8. jasnell commented on May 30, 2017

    @jasnell
    Member

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

  9. shlomif commented on May 30, 2017

    @shlomif
    Author
  10. targos commented on May 30, 2017

    @targos
    Member

    @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.

  11. shlomif commented on May 30, 2017

    @shlomif
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions