Skip to content

[Android] [ANR] Send basic reports without ANR traces - #574

Open
FranAguilera wants to merge 2 commits into
mainfrom
franjam/send-anr-report-with-empty-traces
Open

[Android] [ANR] Send basic reports without ANR traces#574
FranAguilera wants to merge 2 commits into
mainfrom
franjam/send-anr-report-with-empty-traces

Conversation

@FranAguilera

@FranAguilera FranAguilera commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Won't be merging until all recent shared-core changes are validated e.g bitdriftlabs/capture-sdk#1085 . Once bitdriftlabs/capture-sdk#1085 is merged, this and the capture-sdk PR should be merged close in time to avoid breaking main due to the traceInputStream nullable type change ⚠️

Problem

ApplicationExitInfo can return a null stacktrace sometimes via getTraceInputStream parameter given this definition on their docs

“Note that because these traces are kept in a separate global circular buffer, crashes may be overwritten by newer crashes (including from other applications), so this may still return null.”

If that’s the case, getPreviousRunInfo will return ANR as termination reason, but given no report is stored due to the lack of stactrace the count won’t increment in Issue pages/Callback/ANR workflows

For more context please refer to this doc

Solution

Resolves BIT-9198

If we fail to parse a trace (either because being nullable or invalid contents) instead of dropping the report will create a basic one empty stacks/threads using appExitDescription for classification (e.g. User Perceived ANR, BroadcastReceiver, Background ANR, etc).

Verification

Verified in capture-sdk shared-core bump pr bitdriftlabs/capture-sdk#1083

Screenshot 2026-08-06 at 15 48 44

Comment thread bd-report-parsers/src/android.rs Outdated
app_exit_description: Option<&str>,
is_file_size_optimization_enabled: bool,
) -> WIPOffset<v_1::Report<'fbb>> {
if let Some(anr_trace) = anr_trace {

@FranAguilera FranAguilera Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To clarify, now platform layer can pass a Optional (nullable) inputTraceStream. If is not null try to parse, if no errors return the full report. If parsing fails (could be a malformed/incomplete input stream raw report) still send a basic report without stack traces

@FranAguilera
FranAguilera force-pushed the franjam/send-anr-report-with-empty-traces branch from 75a2a77 to fce2fa3 Compare August 6, 2026 23:57
return report;
}

build_anr_without_trace(builder, app_info, device_info, app_exit_description)

@FranAguilera FranAguilera Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the cases where we fail parsing due to incomplete data on the raw report, I still think we should have a general viz count of this error (we have a related project for this, I will add a ticket there and handled then)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice if we included the failure in the report somehow but yeah can handle separately

@FranAguilera
FranAguilera requested a review from snowp August 7, 2026 18:28
return report;
}

build_anr_without_trace(builder, app_info, device_info, app_exit_description)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice if we included the failure in the report somehow but yeah can handle separately

Comment thread bd-report-parsers/src/android_tests.rs
Comment thread bd-report-parsers/src/android.rs Outdated
Comment thread bd-report-parsers/src/android_tests.rs
@FranAguilera
FranAguilera force-pushed the franjam/send-anr-report-with-empty-traces branch from a868bee to c5c142f Compare August 7, 2026 21:22
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.

2 participants