PostHog / PostHog/posthog-android

Attach crash-time properties to recovered native crash events

Open
#700 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feat/error-tracking
Dominant language
Kotlin
Stars
90
Forks
49
Avg merge
2d 5h
Merged PRs (30d)
61

Description

Native crashes (#638, PR #659) are captured on the next app launch. Event properties like $app_version and $os_version come from the new process, not the one that crashed. If the app or OS updated in between, the event points investigation at the wrong version.

The docs call this out as a known limitation for now. The fix is to do what the iOS SDK does for hard crashes:

  • During each run, persist a small snapshot of the volatile properties ($app_version, $app_build, $os_version, $lib_version).
  • On the next launch, match each recovered crash record to the snapshot that was current when it crashed (exit timestamp vs snapshot window), and use those values on the event.
  • Fall back to current-process values when no snapshot matches (e.g. first release with this feature).

Needs a small design pass: when to write the snapshot (startup only vs on change), how many old snapshots to keep and when to clean up, and whether identity (distinct id, session id) should be snapshotted too or stay a documented limitation.

Raised in https://github.com/PostHog/posthog-android/pull/659#discussion_r3720798734.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with native crash capture and next-launch recovery described in issue #638 and PR #659, then read the linked discussion about the proposed fix. Decide the snapshot timing, retention and cleanup, and identity scope before implementing crash-time volatile properties with a current-process fallback. Done means recovered events use the matching crash-time values when available.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.