# nhanelon

> nhanelon detector for Node.js

Latest version **1.2.2** (published 2024-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install nhanelon
pnpm add nhanelon
yarn add nhanelon
bun add nhanelon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2024-03-26 |
| First published | 2024-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | InteliWeb |
| Maintainers | chiricato |
| Keywords | node, hang, detect |

## Links

- npm: https://www.npmjs.com/package/nhanelon
- Repository: https://github.com/steveelon9/nhanelon
- Homepage: https://github.com/steveelon9/nhanelon#readme
- Issues: https://github.com/steveelon9/nhanelon/issues
- npm.io page: https://npm.io/package/nhanelon

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.20.0
- [tangdrv](https://npm.io/package/tangdrv.md) 1.0.4

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2024-03-26
- 0.2.2 — 2024-03-01
- 0.2.1 — 2024-03-01
- 0.2.0 — 2024-03-01

## README

# Hang detector for Node.js
This is a simple package to detect hangs in Node.js applications caused by infinite loop or any other reason that causes the main thread to block.

**nhanelon** starts a worker thread that expects to continuously receive *ping* messages from the main thread. If these messages stop coming, then it is considered a hang.

### Installation

`$ npm install nhanelon`

### Usage

```javascript
const { watch, unwatch } = require('nhanelon');

// Start watch
watch({ checkInterval: 5000, pingInterval: 1000 });

```

By default, when a hang is detected, the process will be aborted. Perhaps you are using a process manager like [pm2](https://github.com/Unitech/pm2 "pm2") which will restart your application.

#### Options

- `checkInterval`
A time delay between each function call in the Worker thread that checks if the main thread is blocked

- `pingInterval`
A time delay between each function call in the main thread that sends *ping* messages to the Worker thread

- `script`
An optional path to the script that is loaded in the Worker thread to handle the hang. The script must export `onHang` function that will be called in the context of the worker thread when a hang is detected. If the script is not set, then the application will simply be terminated.

---
_Source: https://npm.io/package/nhanelon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
