react-native: Android TransactionTooLargeException
- I have reviewed the documentation
- I have searched existing issues
- I am using the latest React Native version
Environment
Environment: OS: macOS High Sierra 10.13.4 Node: 10.2.1 Yarn: 1.7.0 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.3.1 Build version 9E501 Android Studio: 3.1 AI-173.4720617
Packages: (wanted => installed) react: 16.4.0 => 16.4.0 react-native: ^0.55.4 => 0.55.4
Steps to Reproduce
I was unable to find reproduction steps for this error. I’m using crashlytics to collect informations about app crashes, that’s how I found out about this one.
I’m also aware about https://github.com/facebook/react-native/issues/15429, and did updated compileSdkVersion
and targetSdkVersion
to 26, then to 27 and still see this exception reported.
For the latest version it mainly happens on Android 7 and 8 and Samsung and Motorola devices.
Here is a thread dump for one particular instance: org.luksza.habitchallenge_issue_14_crash_5B08A3070387000105A3FE70635B0C4C_DNE_1_v2.txt
Expected Behavior
Application should not crash.
Actual Behavior
Application crashes
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 33
- Comments: 38 (2 by maintainers)
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Still an issue!
Also another note: most React Native apps don’t heavily depend on the saved instance state for restarting, so I believe (we’re testing this right now) it should be safe to just clear the bundle if it’s too large. This is what we’re trying to add to MainActivity:
Unfortunately, the issue is still there in RN 0.63.2. Is there anyone managed to fix it?
Having the same issue on rn 0.62.2
I still have this problem with react-native 61.5. Google’s Crashalytics show the following:
My only package that would write data is Firebase, maybe this is the culprit?
Any updates on this issue? We’re having many cases in our app, and our bug reports all point to this happening when the user puts the app on the background (Always happens after a sequence of
onPause
,onSaveInstanceState
,onStop
). These reports alone is causing the majority of our crashes and the crash rate increased significantly due to it.@fossage Sure, but even under normal circumstances you might use the tool to see if there is something suspicious going on : too much data saved in the views, data placed in the
Bundle
from an unsuspecting source, etc. It’s very likely that something is saving a small amount of data all the time and under certain conditions that small amount of data passes the limit to trigger aTransactionTooLargeException
.Just as a general example : an Android app might implement a
ViewPager
with aFragmentStatePagerAdapter
. Under normal circumstances, eachFragment
will result in a small amount of data getting saved inonSaveInstanceState
of the overallActivity
. If you happen to have dozens and dozens of them, though, this accumulated data could trigger aTransactionTooLargeException
. Something could be happening here with Views.We still see this issue as of with React Native 59.9
The problem is caused by saving too much state in
onSaveInstanceState
. For details see here. Where is all the saved state coming from? Is it being saved by the views? You can use something like TooLargeTool to debug this. If it’s being saved the Activities or Fragments you can use Bridge to get around it. If it’s all in the views themselves, that’s a bit trickier. (Bridge
doesn’t currently support saving state for views, but we’re looking into it.)