Skip to content

can --inspect be made to bind debug ports for child processes too? #459

Description

@AndrewJDR

repro steps (I did this on linux and bash):

git clone https://github.com/AndrewJDR/inspect-on-forked-processes-doesnt-work
cd inspect-on-forked-processes-doesnt-work
npm i
npm start

This starts a child process using cluster.fork(). Note that debugger listens fine on the master process:

Debugger listening on ws://127.0.0.1:9229/1ffaac86-3b3f-4097-aa90-df1eba66b6f4
launching child
in the parent: 13039
in the child: 13049

And checking netstat shows that 9229 is indeed bound, which is good.

$ netstat -lnp | grep 9229
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN      13039/node      

However, no debugging port is bound for the child process. The output of ps, the --inspect-port=9230 argument would lead one to believe that a debugger port 9230 is available for the child process:

$ ps aux | grep ts-node
13027 pts/30   S+     0:00 sh -c ts-node --inspect -F index.ts
13028 pts/30   Sl+    0:00 node ~/Documents/src/inspect-on-forked-processes-doesnt-work/node_modules/.bin/ts-node --inspect -F index.ts
13039 pts/30   Sl+    0:00 ~/.nvm/versions/node/v9.0.0/bin/node --inspect ~/Documents/src/inspect-on-forked-processes-doesnt-work/node_modules/ts-node/dist/_bin.js -F index.ts
13049 pts/30   Sl+    0:00 ~/.nvm/versions/node/v9.0.0/bin/node ~/Documents/src/inspect-on-forked-processes-doesnt-work/node_modules/ts-node/dist/_bin.js --inspect --inspect-port=9230 ~/Documents/src/inspect-on-forked-processes-doesnt-work/index.ts

However, this is unfortunately not the case, looking at netstat output:

$ netstat -lnp | grep 9230
(.. nothing to see here ..)

Can others reproduce this? If so, can this please be addressed so that we can debug child processes properly?

Activity

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

    bugresearchNeeds design work, investigation, or prototyping. Implementation uncertain.you can do thisGood candidate for a pull request.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions