npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gpolakow/native-watchdog

v0.3.2

Published

A native module that kills the current process if the event loop is unresponsive

Downloads

4

Readme

Watchdog node module

Kills the current process when the JavaScript event loop is busy for more than a configurable amount of time. e.g. an accidental while true loop.

This is implemented by launching a separate thread from C++ which periodically checks if an interval timer installed in the JavaScript event loop is fired.

Note: The node module does not distinguish a never-completing operation from a long running operation that will eventually complete. If the event loop appears to be stuck and does not fire timers for a configurable period of time, the node module will terminate the process.

Installing

npm install native-watchdog

Using

var watchdog = require('native-watchdog');

// Configures the module to kill the current process if the event loop
// is unresponsive for more than 5s.
watchdog.start(5000);

The module will print to stderr the JavaScript call stack at the time it detected the JavaScript event loop to be unresponsive and will exit the process with code 87 (unused by node.js):

The module native-watchdog has detected that the event loop is unresponsive.
Here is the JavaScript stack trace:
======================================native-watchdog======================================
bad (/Users/alex/src/node-native-watchdog/test/test.js:16:13)
good (/Users/alex/src/node-native-watchdog/test/test.js:21:5)
Timeout._onTimeout (/Users/alex/src/node-native-watchdog/test/test.js:24:5)
ontimeout (timers.js:386:14)
tryOnTimeout (timers.js:250:5)
Timer.listOnTimeout (timers.js:214:5)
======================================native-watchdog======================================
The module native-watchdog will now terminate the process with exit code 87.

Developing

  • npm install -g node-gyp
  • node-gyp configure
  • node-gyp build (for debugging use node-gyp build --debug)
  • npm test (for debugging change index.js to load the node module from the Debug folder and press F5)

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

MIT