Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

why-is-node-running

Node is running but you don't know why? why-is-node-running is here to help you.

Subscribe to updates I use why-is-node-running


Statistics on why-is-node-running

Number of watchers on Github 674
Number of open issues 6
Average time to close an issue about 10 hours
Main language JavaScript
Average time to merge a PR 4 days
Open pull requests 4+
Closed pull requests 0+
Last commit over 1 year ago
Repo Created almost 4 years ago
Repo Last Updated over 1 year ago
Size 18 KB
Organization / Authormafintosh
Contributors1
Page Updated
Do you use why-is-node-running? Leave a review!
View open issues (6)
View why-is-node-running activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating why-is-node-running for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

why-is-node-running

Node is running but you don't know why? why-is-node-running is here to help you.

Installation

Node 8 and above:

npm i why-is-node-running -g

Earlier Node versions (no longer supported):

npm i why-is-node-running@v1.x -g

Usage

const log = require('why-is-node-running') // should be your first require
const net = require('net')

function createServer () {
  const server = net.createServer()
  setInterval(function () {}, 1000)
  server.listen(0)
}

createServer()
createServer()

setTimeout(function () {
  log() // logs out active handles that are keeping node running
}, 100)

Save the file as example.js, then execute:

node ./example.js

Here's the output:

There are 5 handle(s) keeping the process running

# Timeout
/home/maf/dev/node_modules/why-is-node-running/example.js:6  - setInterval(function () {}, 1000)
/home/maf/dev/node_modules/why-is-node-running/example.js:10 - createServer()

# TCPSERVERWRAP
/home/maf/dev/node_modules/why-is-node-running/example.js:7  - server.listen(0)
/home/maf/dev/node_modules/why-is-node-running/example.js:10 - createServer()

# Timeout
/home/maf/dev/node_modules/why-is-node-running/example.js:6  - setInterval(function () {}, 1000)
/home/maf/dev/node_modules/why-is-node-running/example.js:11 - createServer()

# TCPSERVERWRAP
/home/maf/dev/node_modules/why-is-node-running/example.js:7  - server.listen(0)
/home/maf/dev/node_modules/why-is-node-running/example.js:11 - createServer()

# Timeout
/home/maf/dev/node_modules/why-is-node-running/example.js:13 - setTimeout(function () {

CLI

You can also run why-is-node-running as a standalone if you don't want to include it inside your code. Sending SIGUSR1 signal to the process will produce the log.

why-is-node-running /path/to/some/file.js
probing module /path/to/some/file.js
kill -SIGUSR1 31115 for logging

To trigger the log:

kill -SIGUSR1 31115

License

MIT

why-is-node-running open issues Ask a question     (View All Issues)
  • about 3 years Hangs in node v6.6.0?
  • over 3 years Is it possible to have more context?
  • over 3 years eval'ed code will fail.
  • over 3 years How to use it to troubleshoot Gulp tasks?
  • over 3 years TypeError: Cannot read property 'indexOf' of undefined & TypeError: this._handle.close is not a function
  • over 3 years TypeError: self._handle.connect is not a function
  • over 3 years Programatic usage
  • over 3 years Document usage of internals
  • over 3 years Cannot find module 'internal/linkedlist'
  • almost 4 years Still Running
why-is-node-running open pull requests (View All Pulls)
  • Allow to get handlers programmatically
  • documenting the --expose-internals requirement
  • fix #21
  • fix logout unknown handles when there are no known handles
why-is-node-running list of languages used
Other projects in JavaScript