TacoTheDank / Scoop

[ADB/Root] Catches a stack trace when an app crashes unexpectedly.
Apache License 2.0
311 stars 25 forks source link

TransactionTooLargeException when navigate from apps list to individual app crashes list #45

Open insiderser opened 2 years ago

insiderser commented 2 years ago

Steps to reproduce

  1. Have a large list of crashes.
  2. Open the Scoop app.
  3. Can see the apps list.
  4. Navigate to the list of crashes of any app.

Expected behavior

Can see the list of crashes of the selected app.

Actual behavior

Crash:

E AndroidRuntime: java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1094132 bytes
E AndroidRuntime:        at android.app.ActivityClient.activityStopped(ActivityClient.java:87)
E AndroidRuntime:        at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:143)
E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:938)
E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7842)
E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E AndroidRuntime: Caused by: android.os.TransactionTooLargeException: data parcel size 1094132 bytes
E AndroidRuntime:        at android.os.BinderProxy.transactNative(Native Method)
E AndroidRuntime:        at android.os.BinderProxy.transact(BinderProxy.java:571)
E AndroidRuntime:        at android.app.IActivityClientController$Stub$Proxy.activityStopped(IActivityClientController.java:1315)
E AndroidRuntime:        at android.app.ActivityClient.activityStopped(ActivityClient.java:84)
E AndroidRuntime:        ... 9 more

Reproduction Rate

100%

Workaround

Clear the crashes history.

TacoTheDank commented 2 years ago

May I ask how many crashes you had collected to cause this, just for curiosity's sake?

insiderser commented 2 years ago

May I ask how many crashes you had collected to cause this, just for curiosity's sake?

Over 200. Can't say now as I've cleared the history after creating this issue.

TacoTheDank commented 2 years ago

Oh geez lol. Yeah perhaps you should've cleaned that up beforehand.

Regardless, I'll need to figure out if I can handle the exception gracefully so the app doesn't straight up crash.

insiderser commented 2 years ago

This is not a right way to fix this. I'm an Android developer myself.

I see the app is currently saving the whole crashes list in onSaveInstanceState. This "state" has a limit of 512KB in size. It's not really meant to store unbounded lists.

A more correct way would be to use a ViewModel. It would download all crashes when the VM is being initialized. The crashes list would be stored in a variable in VM. Then when the user returns back to MainActivity, it would just observe data from VM. Then you don't need onSaveInstanceState.

I see the app code is quite old. Feel free to ask any questions, I'm happy to help. Maybe I'll be able to contribute something to this app in the future, but I don't have much free time at the moment.

TacoTheDank commented 2 years ago

@insiderser Honestly I agree. The app needs to be pretty much fully rewritten to use modern architecture (MVVM, AndroidX Room, etc.). I'm doing pretty much doing the best I can to keep the app functioning well enough for the foreseeable future until I am capable of rewriting the app completely and actually have the time to do so.