Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransactionTooLargeException thrown when clicking on "SHARE" from Timber plugin #184

Open
TylerMcCraw opened this issue Sep 30, 2019 · 4 comments

Comments

@TylerMcCraw
Copy link

This exception was thrown when clicking on the "SHARE" button from the Hyperion Timber plugin.
Our logs were 2172540 bytes (almost 2.2 MB), which isn't very large, but obviously is an accumulation of a decently significant amount of logging.

Using Hyperion version 0.9.27
Crash happened on Samsung Galaxy S9 (Android 9.0) and a Google Pixel 2 XL (Android 10.0).

Stacktrace:

Caused by android.os.TransactionTooLargeException: data parcel size 2172540 bytes
       at android.os.BinderProxy.transactNative(BinderProxy.java)
       at android.os.BinderProxy.transact + 510(BinderProxy.java:510)
       at android.app.IActivityTaskManager$Stub$Proxy.startActivity + 3847(IActivityTaskManager.java:3847)
       at android.app.Instrumentation.execStartActivity + 1712(Instrumentation.java:1712)
       at android.app.Activity.startActivityForResult + 5192(Activity.java:5192)
       at androidx.fragment.app.FragmentActivity.startActivityForResult + 676(FragmentActivity.java:676)
       at android.app.Activity.startActivityForResult + 5150(Activity.java:5150)
       at androidx.fragment.app.FragmentActivity.startActivityForResult + 663(FragmentActivity.java:663)
       at android.app.Activity.startActivity + 5521(Activity.java:5521)
       at android.app.Activity.startActivity + 5489(Activity.java:5489)
       at androidx.core.app.ShareCompat$IntentBuilder.startChooser + 357(ShareCompat.java:357)
       at com.willowtreeapps.hyperion.timber.list.TimberLogListActivity.collectLogs + 89(TimberLogListActivity.java:89)
       at com.willowtreeapps.hyperion.timber.list.TimberLogListActivity.onClick + 68(TimberLogListActivity.java:68)
       at android.view.View.performClick + 7140(View.java:7140)
       at android.view.View.performClickInternal + 7117(View.java:7117)
       at android.view.View.access$3500 + 801(View.java:801)
       at android.view.View$PerformClick.run + 27351(View.java:27351)
       at android.os.Handler.handleCallback + 883(Handler.java:883)
       at android.os.Handler.dispatchMessage + 100(Handler.java:100)
       at android.os.Looper.loop + 214(Looper.java:214)
       at android.app.ActivityThread.main + 7356(ActivityThread.java:7356)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 492(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main + 930(ZygoteInit.java:930)
Fatal Exception: java.lang.RuntimeException: Failure from system
       at android.app.Instrumentation.execStartActivity + 1718(Instrumentation.java:1718)
       at android.app.Activity.startActivityForResult + 5192(Activity.java:5192)
       at androidx.fragment.app.FragmentActivity.startActivityForResult + 676(FragmentActivity.java:676)
       at android.app.Activity.startActivityForResult + 5150(Activity.java:5150)
       at androidx.fragment.app.FragmentActivity.startActivityForResult + 663(FragmentActivity.java:663)
       at android.app.Activity.startActivity + 5521(Activity.java:5521)
       at android.app.Activity.startActivity + 5489(Activity.java:5489)
       at androidx.core.app.ShareCompat$IntentBuilder.startChooser + 357(ShareCompat.java:357)
       at com.willowtreeapps.hyperion.timber.list.TimberLogListActivity.collectLogs + 89(TimberLogListActivity.java:89)
       at com.willowtreeapps.hyperion.timber.list.TimberLogListActivity.onClick + 68(TimberLogListActivity.java:68)
       at android.view.View.performClick + 7140(View.java:7140)
       at android.view.View.performClickInternal + 7117(View.java:7117)
       at android.view.View.access$3500 + 801(View.java:801)
       at android.view.View$PerformClick.run + 27351(View.java:27351)
       at android.os.Handler.handleCallback + 883(Handler.java:883)
       at android.os.Handler.dispatchMessage + 100(Handler.java:100)
       at android.os.Looper.loop + 214(Looper.java:214)
       at android.app.ActivityThread.main + 7356(ActivityThread.java:7356)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 492(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main + 930(ZygoteInit.java:930)
@TylerMcCraw
Copy link
Author

TylerMcCraw commented Sep 30, 2019

The issue is here:
https://github.com/willowtreeapps/Hyperion-Android/blob/develop/hyperion-timber/src/main/java/com/willowtreeapps/hyperion/timber/list/TimberLogListActivity.java#L125

My guess is that the intent builder can't handle loading text that is this large.

Solution could be to instead pass a file containing the contents of the logs with the intent.

val logsFile = writeToFile(logs.toString())
val uriToLogs = FileProvider.getUriForFile(context, FILES_AUTHORITY, logsFile)
var shareIntent = ShareCompat.IntentBuilder.from(activity).setStream(uriToLogs).getIntent()
// Provide read access
shareIntent.setData(uriToImage)
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)

@ToxicBakery
Copy link
Contributor

Did you modify the circular buffer limit in your use case? The default is 200 messages so you're average over 10kB per message which is pretty hefty.

The file writing concept is sound though as an easy fix. If you wanted to create a PR for that, I wouldn't have any issues approving it.

@TylerMcCraw
Copy link
Author

I did not modify the buffer limit. I think that it's possibly due to some of the individual messages being very large in size.

I'll try to get to a PR for that as soon as I can!
Is there any concern about adding FileProvider authority with specific file paths for Hyperion?
Are there any other Hyperion plugins that do this already?

@ToxicBakery
Copy link
Contributor

Nothing comes to mind. @nishtahir you have any problems with this change?

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

No branches or pull requests

2 participants