Skip to content

feat(anr): [Non-Fatal ANR 5] Report non-fatal ANRs - #6726

Open
markushi wants to merge 27 commits into
markushi/feat/non-fatal-anr-4-wire-recorderfrom
markushi/feat/non-fatal-anr-5-report-non-fatal-anrs
Open

markushi wants to merge 27 commits into
markushi/feat/non-fatal-anr-4-wire-recorderfrom
markushi/feat/non-fatal-anr-5-report-non-fatal-anrs

Conversation

@markushi

@markushi markushi commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Adds NonFatalAnrIntegration (API 30+) and the options nonFatalAnrSampleRate and nonFatalAnrThresholdMs (also as manifest metadata). nonFatalAnrSampleRate is drawn at each hang. Writes the last_non_fatal_anr marker for hangs that can also be a fatal ANR.

Design: Non-Fatal ANR Architecture (JAVA-777)

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

🤖 Generated with Claude Code

#skip-changelog

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit a66ae84.

Main concerns: public contract, data sent to Sentry, host performance.

Rules that block low also fired:

  • R4: a public API record changed: sentry-android-core/api/sentry-android-core.api

This label is a hint for reviewers, not an approval.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against a66ae84

@markushi
markushi added this pull request to stack #6730 November 20, 2026 17:55
@sentry

sentry Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.65.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 23, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 24, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 24, 2026
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 24, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@linear-code

linear-code Bot commented Nov 24, 2026

Copy link
Copy Markdown

JAVA-762

@markushi
markushi removed this pull request from stack #6753 November 25, 2026 09:41
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026
@markushi
markushi added this pull request to stack #6761 November 25, 2026 09:41
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 27, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

exception.setValue("Non-fatal ANR");
exception.setMechanism(mechanism);
exceptions = Arrays.asList(exception);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong fallback exception type

Low Severity

When there is no culprit stack, the fallback exception sets type to ApplicationNotResponding.class.getName(), the FQCN. AnrCulpritEventHelper instead sets type to ApplicationNotResponding and module to io.sentry.android.core. Hangs without a usable stack therefore show a different exception type and can group apart from sampled non-fatal ANRs even with the same fingerprints.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cabe2f1. Configure here.

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 27, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a66ae84. Configure here.

exception.setType(ApplicationNotResponding.class.getName());
exception.setValue("Non-fatal ANR");
exception.setMechanism(mechanism);
exceptions = Arrays.asList(exception);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallback ANR type uses FQCN

Medium Severity

When a hang has no usable stack samples, the fallback exception sets type to ApplicationNotResponding.class.getName() (the FQCN) and leaves module unset. Culprit events built through AnrCulpritEventHelper instead use simple name plus package. Those two shapes group as different issues, so recovered hangs without samples split from the rest.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a66ae84. Configure here.

return;
}
final long endTimestampMs = record.getStartTimestampMs() + record.getDurationMs();
scopes.captureEvent(buildEvent(record, endTimestampMs));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing non-fatal ANR marker

Medium Severity

The integration reports a recovered hang and never writes the last_non_fatal_anr marker. A hang that is long enough for Android to still kill the process (for example after backgrounding) can then also be sent as a fatal ANR on the next launch, duplicating the same incident.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a66ae84. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant