Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report async tasks to V8 Inspector #13870

Closed
wants to merge 5 commits into from

Commits on Aug 17, 2017

  1. process: add "process.bits" property

    Expose a new property that can be used by JS-land code to detect
    whether Node.js was compiled in 32bit or 64bit mode. This is important
    when converting from JavaScript numbers to raw pointers: JavaScript
    always stores numbers as 64bit, but the pointer size is 32 bits or
    64 bits depending on the platform.
    bajtos authored and TimothyGu committed Aug 17, 2017
    Configuration menu
    Copy the full SHA
    7a0e3b8 View commit details
    Browse the repository at this point in the history
  2. inspector: enable async stack traces

    Implement a special async_hooks listener that forwards information
    about async tasks to V8Inspector asyncTask* API, thus enabling
    DevTools feature "async stack traces".
    
    The feature is enabled only on 64bit platforms due to a technical
    limitation of V8 Inspector: inspector uses a pointer as a task id,
    while async_hooks use 64bit numbers as ids.
    
    To avoid performance penalty of async_hooks when not debugging,
    the new listener is enabled only when the process enters a debug mode:
    
     - When the process is started with `--inspect` or `--inspect-brk`,
       the listener is enabled immediately and async stack traces
       lead all the way to the first tick of the event loop.
    
     - When the debug mode is enabled via SIGUSR1 or `_debugProcess()`,
       the listener is enabled together with the debugger. As a result,
       only async operations started after the signal was received
       will be correctly observed and reported to V8 Inspector. For example,
       a `setInterval()` called in the first tick of the event will not be
       shown in the async stack trace when the callback is invoked. This
       behaviour is consistent with Chrome DevTools.
    
    Last but not least, this commit fixes handling of InspectorAgent's
    internal property `enabled_` to ensure it's set back to `false`
    after the debugger is deactivated (typically via `process._debugEnd()`).
    bajtos authored and TimothyGu committed Aug 17, 2017
    Configuration menu
    Copy the full SHA
    97ea1cb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0e4e338 View commit details
    Browse the repository at this point in the history
  4. fixup! convert tests

    TimothyGu committed Aug 17, 2017
    Configuration menu
    Copy the full SHA
    8164c77 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c197bc8 View commit details
    Browse the repository at this point in the history