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

fix(node): Fixes and improvements to ANR detection #9128

Merged
merged 11 commits into from Sep 29, 2023

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Sep 27, 2023

This PR:

  • Adds support for pm2 (closes Application Not Responding (ANR) feature breaks use with PM2 #9131)
    • Passes SENTRY_ANR_CHILD_PROCESS environment variable to the child process for reliable child process detection
    • To support cluster mode, process.env.pm_exec_path is used for entryScript over process.argv[1]
      • It's worth noting that in cluster mode, an ANR child process is started for every forked cluster process. If you cluster on 8 cores, this will result in 8 ANR process with roughly 400MB of memory overhead.
  • Changes to use spawn rather than fork since fork in Electron does not run a fully Electron capable node process so we can't get all the required context
  • Disables tracing and session tracking for ANR child process
  • Handles inspector port already in use
    • inspector.open() defaults to port 9229. When inspector.url() returns undefined we now try the next port
  • Improves logging to aid in future debugging of issues

@timfish timfish marked this pull request as draft September 27, 2023 11:10
@timfish

This comment was marked as outdated.

@timfish timfish changed the title fix(node): Use spawn rather than fork for ANR fix(node): Fixes and improvements to ANR detection Sep 27, 2023
@timfish timfish marked this pull request as ready for review September 28, 2023 18:20
@AbhiPrasad AbhiPrasad merged commit f22bb15 into getsentry:develop Sep 29, 2023
49 checks passed
@timfish timfish self-assigned this Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Application Not Responding (ANR) feature breaks use with PM2
3 participants