Skip to content

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

License

Notifications You must be signed in to change notification settings

mafintosh/block-trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published