clariusdev/mobileapi

Freezing image stream with `FAILED BINDER TRANSACTION` error

Closed this issue · 3 comments

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.

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:

  • image size is too big
  • message objects are not released fast enough, keeping memory allocated for too long
  • your process performs other transactions counting toward the 1MB limit

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.

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