sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Support multi-process scope sync

Open romtsn opened this issue 1 year ago • 1 comments

Description

Currently if the Android SDK is used in an multi-process app, the scopes are not synchronized between processes, meaning breadcrumbs/tags/contexts from one process will not show up for errors from another. We should probably introduce a flag to make this opt-in, and to make it work we can do one of the following:

  1. Communicate between processes using IBinder through a bound service and package data as Parcelable. Here's a good example on implementing IPC: https://github.com/perihanmirkelam/IPC-Examples
  2. Persist the scope data to disk from both processes and when an error occurs in any of them, use the persisted data in favour of what's currently in-memory. We already do persist the data for ANRs, so it could be as simple as replacing our MainEventProcessor and DefaultAndroidEventProcessor with a new one that reads the data from disk (use AnrV2EventProcessor as prior art).

romtsn avatar Nov 05 '24 22:11 romtsn

An example use case is when using Unity as a Library (UaaL) which runs in a separate process.

kahest avatar Nov 06 '24 14:11 kahest