What use cases exist for async_hooks?

  • long stack traces
    - can produce more meaningful error information
    - helpful for debugging complex async execution chains
  • lifecycle tracking of libuv requests/handles
    - helps detect resource starvation
    - could probably provide some meta information to differentiate requests/handles
  • detecting blocking code
    - measuring sync execution time of each callback
    - helps to identify code that could be moved to worker threads
  • counting created promises
  • detecting port of new servers without monkey-patching



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



Node.js is a collaborative open source project dedicated to building and supporting the Node.js platform. https://nodejs.org/en/