Skip to content

Start node in inspect mode will cause CPU consumption 100% #25077

Closed
@wu-jingtao

Description

@wu-jingtao
  • docker:10-stretch
  • Host computer:Linux test 4.4.0-137-generic io.js TC Meeting 2014-12-17 #163-Ubuntu SMP Mon Sep 24 13:14:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I find when using child_process.fork to spawn the third layer child process with the debugger mode will cause CPU consumption to 100%,this problem will keep until you use a debugger tool ( like chrome debugger tool ) to connect it. after connected, the CPU consumption will soon drow back to normal status.

I`m sure this is not my code`s problem, and I`ve tried in my notebook and cloud server, this problem will always occur.

Process tree:

node .
    └  /usr/local/bin/node /app/subprocess.js
         └  /usr/local/bin/node --inspect-brk=127.0.0.1:6060 /app/third.js

Main process code:

child_process.fork(path.resolve(__dirname, './subprocess.js'))

Subprocess code:

 const child = child_process.fork(taskFilePath, [], {
     cwd: FilePath._programDataDir,
     execArgv: debug ? [`--inspect-brk=127.0.0.1:${debugPort}`] : [],
     stdio: ['pipe', 'pipe', 'pipe', 'ipc']
});

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