Fun with async hooks and stack traces
summary
Uses async_hooks to capture init stacks and then counts actual Promise allocations, measures event-loop blocking by comparing before/after timestamps, and extracts the declaration line with error.captureStackTrace so the exact function that stalled the loop is reported. Builds an npm tool debugging-aid package with helpers: a blocked-at tracer that prints file/line and duration, a package-firewall that detects which dependency opens network sockets via monkey‑patching, and a trace-events exporter that visualizes promise lifetimes — demos show these tools work on real examples.
AI-written summary · about
chapters (4)
- 0:00Start
- 8:46What Are Chasing Hooks
- 16:29Find Out Which Function Is Blocking the Event Loop
- 18:00Capture Stacktrace








