GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Long stack traces in core · Issue #31080 · nodejs/node

Long stack traces in core #31080

New issue
Copy link
New issue
Copy link
Closed
Closed
Long stack traces in core#31080
Copy link
Labels
async_hooksIssues and PRs related to the async hooks subsystem.feature requestIssues requesting new Node.js features.

Description

@addaleax
addaleax
opened on Dec 24, 2019
Issue body actions

With all the work currently being done around async_hooks and stack trace enhancement through e.g. source maps, I’m wondering whether we should bring official long stack trace support into core.

I’d personally love to see it – I’m certainly biased, but for debugging flaky tests alone it would make things a lot easier to not to have to pull in an external utility for that (or to have to write an ad-hoc one).

Alternatives would be to keep these utilities in userland and/or to just vendor one in but keep developing it outside of core. In particular the latter also seems good to me.

@nodejs/async_hooks @bcoe @AndreasMadsen

Reacted by Ruben Bridgewater, Benjamin Gruenbaum, antsmartian, Benjamin E. Coe, Dmitriy Tsvettsikh, Zach Bjornson, Cees Timmerman, Szymon Marczak, Jarda Kotěšovec, Mark Wylde and 3 more

Activity

  1. addaleax
    added
    async_hooksIssues and PRs related to the async hooks subsystem.
    feature requestIssues requesting new Node.js features.
    on Dec 24, 2019
  2. benjamingr commented on Dec 24, 2019

    @benjamingr
    benjamingr
    on Dec 24, 2019
    Member
    More actions

    I'm not sure what that would entail.

    Also - do you mean for things other than async functions?

    I was under the impression that we already do have long stack traces in core (for async functions) with --async-stack-traces

  3. benjamingr commented on Dec 24, 2019

    @benjamingr
    benjamingr
    on Dec 24, 2019
    Member
    More actions

    I am obviously a big +1 on anything that makes debugging async code easier :)

    Reacted by Cees Timmerman and Benjamin E. Coe
  4. addaleax commented on Dec 24, 2019

    @addaleax
    addaleax
    on Dec 24, 2019
    MemberAuthor
    More actions

    @benjamingr I’m talking about any async resources, not just async functions here :) So including nextTicks, timers, etc.

  5. cjihrig commented on Dec 24, 2019

    @cjihrig
    cjihrig
    on Dec 24, 2019
    Contributor
    More actions

    I'm +1 on the idea in general.

    Alternatives would be to keep these utilities in userland and/or to just vendor one in but keep developing it outside of core.

    I'd be OK with that if the vendored module behaved like any other core module. For example, when we added rimraf support, the userland module didn't really have the same developer experience, mostly around things like option names and error handling.

    Reacted by Anna Henningsen and antsmartian
  6. gireeshpunathil commented on Dec 24, 2019

    @gireeshpunathil
    gireeshpunathil
    on Dec 24, 2019
    Member
    More actions

    sorry for asking a basic question: what is a long stack trace? a simulated chain of stack traces that belong to one logical call unit but were never available together in the thread stack due to the presences of async calls? or is it something else?

  7. addaleax commented on Dec 24, 2019

    @addaleax
    addaleax
    on Dec 24, 2019
    MemberAuthor
    More actions

    @gireeshpunathil Yes, exactly.

    Reacted by Gireesh Punathil
  8. joyeecheung commented on Dec 24, 2019

    @joyeecheung
    joyeecheung
    on Dec 24, 2019
    Member
    More actions

    I guess the confusion comes from that the concept is usually referred to as "async stack trace"? (e.g. the asyncStackTrace implemented by our inspector agent when Debugger.setAsyncCallStackDepth is sent, which is implemented using async hooks). So essentially this means we are going to always do this instead of reserving it for handling Debugger.setAsyncCallStackDepth in the inspector?

    Reacted by Gireesh Punathil and Benjamin Gruenbaum
  9. addaleax commented on Dec 24, 2019

    @addaleax
    addaleax
    on Dec 24, 2019
    MemberAuthor
    More actions

    @joyeecheung Not always – I’m thinking that this would be enabled through e.g. a command line flag.

  10. joyeecheung commented on Dec 24, 2019

    @joyeecheung
    joyeecheung
    on Dec 24, 2019
    Member
    More actions

    @addaleax I see. I would be inclined to maintaining this in core instead of vendoring in one in considering we already have an implementation in Node.js core for the inspector. We could essentially just refactor that code so that it reports to something that can be fetched by e.g. our stack trace preparation callback. (this again brings up the issue about making it play along with user-land Error.prepareStackTrace though)

    Reacted by Anna Henningsen
  11. addaleax commented on Dec 24, 2019

    @addaleax
    addaleax
    on Dec 24, 2019
    MemberAuthor
    More actions

    (this again brings up the issue about making it play along with user-land Error.prepareStackTrace though)

    I, personally, would be consider a solution along the lines of #30984 to be perfect (e.g. adding callFrame.asyncDepth()), but I’m afraid there’s going to be opposition against that like there is for the other PR.

  12. bcoe commented on Dec 24, 2019

    @bcoe
    bcoe
    on Dec 24, 2019
    Contributor
    More actions

    @addaleax @joyeecheung just seeing this. I liked @joyeecheung's suggestion of potentially adding an additional parameter to prepareStackTrace, which could be used to lookup additional interesting information about the stack frame. I can see why folks were squeamish about simply packing this information on to the stack frame objects that originate in (I believe) V8?

    Perhaps we could hammer out a little RFC document for this proposal?

  13. joyeecheung commented on Dec 24, 2019

    @joyeecheung
    joyeecheung
    on Dec 24, 2019
    Member
    More actions

    @bcoe To clarify I was just suggesting fetching the information in our internal stack trace preparation callback, which calls the user-land Error.prepareStackTrace. To also expose something to the user-land hook could be a nice-to-have, but it seems complicated so I would not consider that a blocker (first of all, be aware that we currently always respect the user-landError.prepareStackTrace from the main context so it's easy to mess up across contexts if we are not careful).

  14. reklatsmasters commented on Dec 24, 2019

    @reklatsmasters
    reklatsmasters
    on Dec 24, 2019
    Contributor
    More actions

    It also should have an option to return stack trace only for userland code.

    Reacted by Benjamin Gruenbaum and Cees Timmerman
  15. mcollina commented on Jan 31, 2022

    @mcollina
    mcollina
    on Jan 31, 2022
    SponsorMember
    More actions

    I think this was partially solved in latests V8 with long stack traces with async functions, I'm going to close this.

  16. darky commented on Jan 31, 2022

    @darky
    darky
    on Jan 31, 2022
    Contributor
    More actions

    What about process.nextTick, timeouts and so on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    async_hooksIssues and PRs related to the async hooks subsystem.feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.