Skip to content

Print a "current stack/callback/promise dump" from a running program #51980

Closed as not planned
@DanKaplanSES

Description

@DanKaplanSES

What is the problem this feature will solve?

Somewhere in my program I believe I have a Promise that never resolves/rejects, and it's difficult to troubleshoot without modifying the code:

  1. I could add log statements everywhere
  2. I could wrap every existing promise in a Promise.race([PromiseWithTimeout, OriginalPromise])
  3. I could get v21+ and use --trace-promises to see if it prints enough information for me to figure out which promise is stuck.

While I haven't tried 3., it sounds extremely useful. That said, in a situation where the program hangs without error, I think a similar feature may be a better tool for the job: The ability to dump the current stack/callback/promises of a running program. As far as I know, this feature doesn't exist in node, but it does in other runtimes (see below).

For the original context of this feature request, see my StackOverflow post titled, How do you find the stack trace of a JavaScript Promise that never resolves?

What is the feature you are proposing to solve the problem?

In my SO post I mention that "Java has ways to see all the stack traces of all the threads of a program." [by running kill -3 <java_process_id>]. I'd like to request a similar feature in node.js.

What alternatives have you considered?

I've mentioned three alternatives in the list above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions