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

Application Not Responding (ANR) feature breaks use with PM2 #9131

Closed
3 tasks done
joshkel opened this issue Sep 27, 2023 · 2 comments · Fixed by #9128
Closed
3 tasks done

Application Not Responding (ANR) feature breaks use with PM2 #9131

joshkel opened this issue Sep 27, 2023 · 2 comments · Fixed by #9128
Assignees
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug

Comments

@joshkel
Copy link
Contributor

joshkel commented Sep 27, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.72.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    release: getSentryReleaseIdentifier(),
    environment: process.env.SITE_NAME?.toLowerCase() || undefined,
    initialScope: {
      tags: { commit: version?.commitSha },
    },
  });

Steps to Reproduce

  1. Enable the new Application Not Responding feature:

    await Sentry.enableAnrDetection({ captureStackTrace: true });
  2. Configure the application to run within PM2.

Expected Result

The application works.

Actual Result

Sentry's ANR feature thinks that the application is the ANR watchdog child (because the process has been forked by PM2 and therefore has a process.send), so it doesn't work. (In my local testing, it causes PM2 to treat the process as terminated by SIGINT.)

I could provide a separate entryScript, but that wouldn't help the issue of the parent process thinking it's the child. I think I could delete process.send, but that seems like a hack (and can break PM2 features). Maybe enableAnrDetection needs some sort of "force" parameter? Maybe it should assume it's the parent (ignoring process.send) if an entryScript is provided and/or if entryScript !== process.arg[1]?

@AbhiPrasad
Copy link
Member

Hey @joshkel - thanks for writing in! Your GitHub issue led us to make a bunch of improvements to the ANR tracking in #9128, so appreciate the feedback a lot.

Will update once we've released those improvements. Thanks!

@AbhiPrasad
Copy link
Member

We've released the fix for this issue in https://github.com/getsentry/sentry-javascript/releases/tag/7.73.0. Please give it a try - feedback is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants