Skip to content

Stack trace is missing on ANR's when isAttachStacktrace = false #4904

@Angelodaniel

Description

@Angelodaniel

Integration

sentry-android

Build System

Gradle

AGP Version

?

Proguard

Enabled

Version

8.18.0

Steps to Reproduce

Here's what's happening:
ANR events correctly attach threads because MainEventProcessor checks for the AbnormalExit hint (line 255 in MainEventProcessor.java)
BUT, when SentryThreadFactory.getSentryThread() creates each thread, it checks options.isAttachStacktrace() to decide whether to attach the stacktrace to that thread (line 143)
When you set isAttachStacktrace = false, the threads are still created and attached to the ANR event, but they have no stacktraces
This is a bug in the SDK. The SentryThreadFactory should not use isAttachStacktrace to control stacktrace attachment when threads are being explicitly collected for abnormal exits like ANRs.

Expected Result

logMessage to exclude stacktrace but ANR's to keep them

Actual Result

the isAttachStacktrace = false configuration is causing ANRs to lose their stack traces as well

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions