You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Print a "current stack/callback/promise dump" from a running program #51980
Somewhere in my program I believe I have a Promise that never resolves/rejects, and it's difficult to troubleshoot without modifying the code:
I could add log statements everywhere
I could wrap every existing promise in a Promise.race([PromiseWithTimeout, OriginalPromise])
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).
Promises will not lead to hanging processes. Instead, it is the active uv requests/handles that keep the process running. It is possible to inspect active uv handles with diagnostic reports, which can also be triggered with SIGUSR2 when the process is launched with the flag --report-on-signal.
Promise tracking is expensive and cannot be done on-demand during runtime (it requires to install async_hooks before the promises are created).
I'm not sure it makes much sense to add something like that in core, it should be doable in userland with the async_hooks API.
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.
Activity
legendecas commentedon Mar 7, 2024
Promises will not lead to hanging processes. Instead, it is the active uv requests/handles that keep the process running. It is possible to inspect active uv handles with diagnostic reports, which can also be triggered with
SIGUSR2when the process is launched with the flag--report-on-signal.targos commentedon Mar 7, 2024
Promise tracking is expensive and cannot be done on-demand during runtime (it requires to install async_hooks before the promises are created).
I'm not sure it makes much sense to add something like that in core, it should be doable in userland with the async_hooks API.
github-actions commentedon Sep 4, 2024
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
github-actions commentedon Oct 4, 2024
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.
For more information on how the project manages feature requests, please consult the feature request management document.