clariusdev / mobileapi

Android API Allowing IPC with the Clarius App
https://www.clarius.com
BSD 3-Clause "New" or "Revised" License
12 stars 4 forks source link

Freezing image stream with `FAILED BINDER TRANSACTION` error #13

Closed nnaskov closed 2 years ago

nnaskov commented 2 years ago

Problem

We are facing the following issue with the mobileapi - on Galaxy S10, the image stream would freeze every few seconds. The error in the console logs is:

E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 263244)

I have attached a video with logs. https://user-images.githubusercontent.com/3404751/136535327-c8e49438-2a62-4293-ad02-bfb0b3c7bceb.mp4

Setup

Clarius App/ Probe version - Beta 8.5.1-234+b29e095128 Mobileapi - 8.0.1 Phone used - Galaxy S10, 8GB RAM

Current workaround

The only workaround we found is to detect when the images freeze (no more events MSG_NEW_PROCESSED_IMAGE) and fire another MSG_REGISTER_CLIENT event. This event, triggers the flow of images again.

Failed workarounds

We tried toggling freeze or changing gain/depth but they didn't solve the problem. Only the above method worked.

Technical discussion

Based on the analysis of the logs, it seems that there is a separate background process/thread or service, in the Clarius app which gets killed or something. I'm not sure why the binder doesn't work only for some images but works for most.

NOTE: On Galaxy S21 this issue is much harder to reproduce, so it may be related to constraint resources.

julien-l commented 2 years ago

Hi I suspect it is because your process has reached its limit of 1MB for its transaction buffer. This is documented here https://developer.android.com/guide/components/activities/parcelables-and-bundles#sdbp and here https://developer.android.com/reference/android/os/TransactionTooLargeException.

Potential causes:

Regarding the last point, this is what the Android documentation states:

Since this limit is at the process level rather than at the per activity level, these transactions include all binder transactions in the app such as onSaveInstanceState, startActivity and any interaction with the system.

This is consistent with your observation: "it may be related to constraint resources."

I hope this helps.

clariusk commented 2 years ago

There are some good discussions here: https://stackoverflow.com/questions/11451393/what-to-do-on-transactiontoolargeexception

nnaskov commented 2 years ago

Thanks. I will explore further and report here with developments.