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

Get the js stack trace of a running nodejs process #4039

Closed
ericzhucode opened this issue Nov 26, 2022 · 8 comments
Closed

Get the js stack trace of a running nodejs process #4039

ericzhucode opened this issue Nov 26, 2022 · 8 comments
Labels
needs more info issues that need more info from the author stale

Comments

@ericzhucode
Copy link

ericzhucode commented Nov 26, 2022

Details

Background: If there's an infinite loop in js script, it would be hard to find it. Currently if we found a nodejs process stucks, we would use nodejs debug feature to attach to that process and then pause it, in that way we can find the code of the infinite loop like
image

I'm wondering if there's any params or tools of nodejs to help us output all stack trace of running nodejs process to a log file, so that we can find the infinite loop?

Or is there any other better ways to find the exact code of an infinite loop?
Thank you for your help!

Node.js version

All versions

Example code

No response

Operating system

All systems

Scope

code

Module and version

Not applicable.

@MoLow
Copy link
Member

MoLow commented Nov 26, 2022

@ericzhucode you can fire a SIGUSR1 signal at the process, that will allow you connecting with a debugger

@MoLow
Copy link
Member

MoLow commented Nov 26, 2022

@ericzhucode
Copy link
Author

@ericzhucode you can fire a SIGUSR1 signal at the process, that will allow you connecting with a debugger

Yes I know that and actually if you use vscode to debug nodejs via pid then vscode will automatially send SIGUSR1 signal to that process so that we can attach via a debugger.
However, what we want is to output the stack trace to a log so that supporters can collect that info from user and send to our developers. Supporters may not be able to use IDE to debug so developers will have to join the meeting every time this kind of issue occured.
Is there any way to output the stack trace to a log?

@iloveitaly
Copy link

Same question on my end, would love to know if this is possible @MoLow! Thanks for all your help.

@artur-ma
Copy link

@preveen-stack preveen-stack added the needs more info issues that need more info from the author label Jun 27, 2023
@preveen-stack
Copy link
Contributor

@ericzhucode Were you able to try out the suggestions above?

Copy link

github-actions bot commented May 7, 2024

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment.
If you need further assistance or have questions, you can also search for similar issues on Stack Overflow.
Make sure to look at the README file for the most updated links.

@github-actions github-actions bot added the stale label May 7, 2024
Copy link

github-actions bot commented Jun 7, 2024

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment.
If you need further assistance or have questions, you can also search for similar issues on Stack Overflow.
Make sure to look at the README file for the most updated links.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info issues that need more info from the author stale
Projects
None yet
Development

No branches or pull requests

5 participants