Skip to content

ANR (App Not Responding) child may outlive parent process #9546

@joshkel

Description

@joshkel

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.80.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

  Sentry.init({
    dsn: process.env.SENTRY_DSN,
  });

Steps to Reproduce

Launch my Sentry-enabled app, via PM2 or nohup, with an issue that causes it to crash during initialization.

Sample script:

const Sentry = require('@sentry/node');

async function main() {
  Sentry.init({ dsn: process.env.SENTRY_DSN });

  await Sentry.enableAnrDetection({ captureStackTrace: true });

  process.exit();
}

main();

Run via nohup node test.js or node test.js (observed in macOS - nohup use of may not be necessary).

Expected Result

The child sentry-anr process exits when the parent process does, or it exits as soon as it realizes that the parent is no longer available.

Actual Result

The child sentry-anr process continues to run indefinitely. (In our case, PM2 automatically restarted the parent each time it crashed, which caused another persistent sentry-anr child on each restart attempt, which exhausted the system's memory.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nodeIssues related to the Sentry Node SDK

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions