Skip to content

fix(sdk-crash-detection): Allow ART memory/GC context through event stripper#118915

Merged
runningcode merged 3 commits into
masterfrom
fix/sdk-crash-allow-art-context
Jul 2, 2026
Merged

fix(sdk-crash-detection): Allow ART memory/GC context through event stripper#118915
runningcode merged 3 commits into
masterfrom
fix/sdk-crash-allow-art-context

Conversation

@runningcode

Copy link
Copy Markdown
Contributor

Problem

The Android SDK (getsentry/sentry-java#5428) added ArtContext (serialized under the "art" context key) to ANR events. It contains GC stats and heap memory info parsed from ANR thread dumps — exactly the data needed to understand whether OOM pressure contributed to an ANR.

The sdk_crashes event stripper was silently dropping the entire art context because only device and os were in EVENT_DATA_ALLOWLIST["contexts"].

Fix

Add all 11 ArtContext fields under contexts.art in the allowlist:

  • GC counters/timings: gc.total_count, gc.total_time, gc.blocking_count, gc.blocking_time, gc.pre_oome_count, gc.waiting_time
  • Heap memory snapshots: memory.free, memory.free_until_gc, memory.free_until_oome, memory.total, memory.max

All values are numeric (Long/Doubleint/float), no PII risk.

Test

Added test_strip_event_data_keeps_art_context which injects a full art context (including a some_private_field that should be stripped) and asserts only the allowlisted fields survive.

--

View Junior Session in Sentry

…tripper

Android SDK (getsentry/sentry-java#5428) added ArtContext (context key
"art") to ANR events containing GC and heap memory stats parsed from ANR
thread dumps. The sdk-crashes event_stripper was dropping the entire "art"
context because it wasn't in the allowlist.

Add all 11 ArtContext fields (gc.* and memory.*) under contexts.art so they
survive stripping.
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 2, 2026
@runningcode runningcode marked this pull request as ready for review July 2, 2026 14:43
@runningcode runningcode requested a review from a team as a code owner July 2, 2026 14:43
@runningcode runningcode requested review from markushi and romtsn July 2, 2026 14:43
@runningcode runningcode enabled auto-merge (squash) July 2, 2026 14:45
@runningcode runningcode disabled auto-merge July 2, 2026 14:46
@runningcode runningcode requested a review from romtsn July 2, 2026 14:48
…nt error

event_data["contexts"] is typed as object so direct indexed assignment
fails mypy. Use the already-imported set_path() instead.
@runningcode runningcode enabled auto-merge (squash) July 2, 2026 14:51
@runningcode runningcode merged commit 8dc8446 into master Jul 2, 2026
66 checks passed
@runningcode runningcode deleted the fix/sdk-crash-allow-art-context branch July 2, 2026 15:00
runningcode added a commit that referenced this pull request Jul 2, 2026
…s_art_context

That test belongs to PR #118915 (ART context). It was accidentally included
twice in this branch's test file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants