Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
why-is-node-running
Advanced tools
Node is running but you don't know why? why-is-node-running is here to help you.
The why-is-node-running package is a Node.js module that helps developers diagnose why a Node.js process hasn't exited on its own. It provides insights into what operations are keeping the event loop busy, such as open handles, active timers, and other system tasks that may prevent the process from exiting.
Logging active handles
This feature allows you to log all active handles that are currently preventing Node.js from exiting. It's useful for identifying potential sources of memory leaks or unintended behavior.
const log = require('why-is-node-running');
// somewhere in your long-running program
log(); // logs out active handles that are keeping node running
Logging with a delay
This feature is similar to the previous one, but it allows you to set a delay before logging the active handles. This can be useful when you want to give your application some time to settle before checking what is still running.
const log = require('why-is-node-running');
setTimeout(function () {
log(); // logs out active handles after a delay
}, 10000);
WTFNode is similar to why-is-node-running in that it helps to diagnose what is keeping a Node.js process running. It provides detailed output about timers, sockets, and other resources. It differs in its output format and the level of detail provided.
Node-report is an npm package that provides a diagnostic report on demand or when certain events occur. It's more comprehensive than why-is-node-running, offering information about the system, resource usage, and JavaScript stack trace, but it's not as focused on the reasons why a Node.js process is still running.
Node is running but you don't know why? why-is-node-running is here to help you.
npm install why-is-node-running
var log = require('why-is-node-running') // should be your first require
var net = require('net')
function createServer () {
var server = net.createServer()
setInterval(function () {}, 1000)
server.listen(0)
}
createServer()
createServer()
setTimeout(function () {
log() // logs out active handles that are keeping node running
}, 100)
Running the above will print
There are 4 known handle(s) keeping the process running and 0 unknown
Known handles:
# Timer
/Users/maf/dev/node_modules/why-is-node-running/example.js:6 - setInterval(function () {}, 1000)
/Users/maf/dev/node_modules/why-is-node-running/example.js:10 - createServer()
# TCP
/Users/maf/dev/node_modules/why-is-node-running/example.js:7 - server.listen(0)
/Users/maf/dev/node_modules/why-is-node-running/example.js:10 - createServer()
# TCP
/Users/maf/dev/node_modules/why-is-node-running/example.js:7 - server.listen(0)
/Users/maf/dev/node_modules/why-is-node-running/example.js:11 - createServer()
# Timer
/Users/maf/dev/node_modules/why-is-node-running/example.js:13 - setTimeout(function () {
MIT
FAQs
Node is running but you don't know why? why-is-node-running is here to help you.
The npm package why-is-node-running receives a total of 3,716,615 weekly downloads. As such, why-is-node-running popularity was classified as popular.
We found that why-is-node-running demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.