Skip to content

Problem reports show the run before a crash, on every Android version - #195

Merged
easonxiang merged 1 commit into
mainfrom
run-log
Oct 5, 2026
Merged

easonxiang merged 1 commit into
mainfrom
run-log

Conversation

@easonxiang

Copy link
Copy Markdown
Contributor

Report CB-4K36FJ showed three restarts but no cause. The logs lived only in memory, and Android 6 has no exit reasons.

Changes

  • On-device run log, all builds:
    • logs/castbay.log (Kotlin) and logs/protocol.log (native).
    • Each rotates to .old past a cap: 128 KB in release (internal storage), 10 MB in debug.
    • The previous process's files are kept as .1.
  • Unfinished-run detection:
    • While the receiver service exists, a marker holds the boot ID (/proc/sys/kernel/random/boot_id).
    • If the next process finds that marker from the same boot, it records a Diagnostics event, and reports then include "The previous run, which ended without CastBay stopping it": the last lines of both logs merged by time, scrubbed.
  • Privacy policy (en/zh): describes the on-device log.

Tests

  • Unit test for the time-ordered merge; lintVitalRelease passes.
  • Emulator: started the receiver, ran kill -9 on the process, restarted. The event was recorded, and uploaded report CB-EX1H6J contains the previous run's app and protocol lines in time order.
  • Xiaomi TV (Android 6) is still to be done: its adb went offline mid-test.

🤖 Generated with Claude Code

Report CB-4K36FJ (Xiaomi TV, Android 6) couldn't tell why CastBay had
restarted three times: its logs were in memory and died with the
process, and Android 6 doesn't say why an app ended (Android 11+ do).

- Every build now keeps its log on disk: logs/castbay.log (Kotlin) and
  logs/protocol.log (native, previously only in debug builds, and
  sharing one file). Each starts afresh past a size, keeping the one
  before as .old, so the newest lines survive. Release builds keep
  128 KB per file in internal storage; debug builds 10 MB, on external
  storage when they can. A new process keeps the previous one's as .1.
- While the receiver runs, a marker file records the boot. If the next
  process finds it from the same boot, the previous run ended without
  CastBay stopping it (a crash, or Android ending it): that is noted
  among the Diagnostics events, and a problem report adds that run's
  last lines (both logs, merged in time order), scrubbed like the rest.
- The privacy policy describes the on-device log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@easonxiang
easonxiang merged commit 9b9f9f2 into main Oct 5, 2026
6 checks passed
@easonxiang
easonxiang deleted the run-log branch October 5, 2026 06:48
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.

1 participant