当CPU旋转和退出程序的堆栈跟时,找出node进程是否受阻

网友投稿 520 2022-10-22

当CPU旋转和退出程序的堆栈跟时,找出node进程是否受阻

当CPU旋转和退出程序的堆栈跟时,找出node进程是否受阻

block-trace

Figure out if your node process is blocked because the CPU is spinning and exit the program with a stack trace if that is the case.

Useful for debugging unresponsive servers.

npm install -g block-trace

Usage

Giving the following example program

console.log('Waiting 1s ...')setTimeout(function () { console.log('Spinning the CPU now!') while (1) {}}, 1000)

If you run this with block-trace by doing the following

block-trace node example.js

After 1s the program will exit with the following output

Waiting 1s ...Spinning the CPU now!Error: CPU is blocked at /Users/maf/dev/node_modules/block-trace/example.js:5:10 at Timer.listOnTimeout (timers.js:92:15)

License

MIT

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:YCKIT- 一个基于PHP+MYSQL架构下的敏捷开发框架
下一篇:AQS同步组件-ForkJoin、BlockingQueue阻塞队列解析和用例
相关文章

 发表评论

暂时没有评论,来抢沙发吧~