Skip to content

Fix: Fix DeadObjectException inside AutoUpdateServiceConnection - #11

Merged
Aghajari merged 4 commits into
cafebazaar:masterfrom
behnawwm:fix/fix-autoupdate-service-crash
Oct 6, 2025
Merged

Fix: Fix DeadObjectException inside AutoUpdateServiceConnection#11
Aghajari merged 4 commits into
cafebazaar:masterfrom
behnawwm:fix/fix-autoupdate-service-crash

Conversation

@behnawwm

@behnawwm behnawwm commented Oct 5, 2025

Copy link
Copy Markdown

This PR tries to resolve the DeadObjectException crash on some devices
The issue may come across two reasons:

  1. That remote process (in this case, the Bazaar app / update service) crashed, was killed, or disconnected right before or during your call.
  2. The Binder reference (boundService) became invalid — hence DeadObjectException.

So the issue could be calling service.isAutoUpdateEnabled() inside a coroutine on Dispatchers.IO, possibly seconds after onServiceConnected() returns.

That’s fine in principle, but if:

  • The Bazaar process dies or is killed (e.g., low memory),
  • Or your Activity/Service unbinds the connection,
  • Or system reclaims the binder after a timeout,

the binder proxy becomes invalid → DeadObjectException.

@Aghajari

Aghajari commented Oct 5, 2025

Copy link
Copy Markdown
Member

Just to confirm, have you tested these changes? Maybe by manually throwing a DeadObjectException before the changes?

@behnawwm

behnawwm commented Oct 6, 2025

Copy link
Copy Markdown
Author

Yup! It worked in that way in the sample app.

@Aghajari

Aghajari commented Oct 6, 2025

Copy link
Copy Markdown
Member

Thanks for the PR @behnawwm

@Aghajari
Aghajari merged commit a419f5a into cafebazaar:master Oct 6, 2025
1 check failed
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