Debugging Node.js processes with cluster.fork()

前端 未结 6 2134
南方客
南方客 2020-12-23 21:39

I\'ve got some code that looks very much like the sample in the Cluster documentation at http://nodejs.org/docs/v0.6.0/api/cluster.html, to wit:

var cluster          


        
6条回答
  •  再見小時候
    2020-12-23 22:36

    var fixedExecArgv=[];
    fixedExecArgv.push('--debug-brk=5859');
    cluster.setupMaster({ 
      execArgv: fixedExecArgv 
    });
    

    Credit goes to Sergey's post.

    I changed my server.js to fork only one worker mainly for testing this then added the code above the forking. This fixed the debugging issue for me. Thank you Sergey for explaining and providing the solution!!!

提交回复
热议问题