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

rememberGeoJsonSourceState causes transaction too large exception when saving state #2465

Open
jacobtabak opened this issue Aug 22, 2024 · 1 comment
Labels
bug 🪲 Something isn't working compose

Comments

@jacobtabak
Copy link

Environment

  • Android OS version: any
  • Devices affected: any
  • Maps SDK Version: 11.6.0

Observed behavior and steps to reproduce

  • Remember a lot of complicated geometry using rememberGeoJsonSourceState
  • Pause the app by backgrounding it
  • Experience TransacationTooLarge crash when compose tries to persist the geometry into a bundle

We are loading some pretty complex geometry (testing with 1175 features) and following the examples, I tried using rememberGeoJsonSourceState in compose. However, under the hood, this function uses rememberSaveable which tries to persist all of those features to a bundle to save their state when the activity is paused. This of course causes a crash for our use case which was a bit tricky to debug because it was not immediately clear why the bundle was so large until we dug into the code.

Would it be reasonable to suggest making separate functions for rememberGeoJsonSourceState and rememberGeoJsonSourceStateSaveable? For our use case we just implemented a non-saveable version.

Expected behavior

Don't crash when saving state

Notes / preliminary analysis

Additional links and references

                                         java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 687388 bytes
                                         	at android.app.ActivityClient.activityStopped(ActivityClient.java:87)
                                         	at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:143)
                                         	at android.os.Handler.handleCallback(Handler.java:938)
                                         	at android.os.Handler.dispatchMessage(Handler.java:99)
                                         	at android.os.Looper.loopOnce(Looper.java:201)
                                         	at android.os.Looper.loop(Looper.java:288)
                                         	at android.app.ActivityThread.main(ActivityThread.java:7870)
                                         	at java.lang.reflect.Method.invoke(Native Method)
                                         	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                         	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
                                         Caused by: android.os.TransactionTooLargeException: data parcel size 687388 bytes
                                         	at android.os.BinderProxy.transactNative(Native Method)
                                         	at android.os.BinderProxy.transact(BinderProxy.java:571)
                                         	at android.app.IActivityClientController$Stub$Proxy.activityStopped(IActivityClientController.java:1315)
                                         	at android.app.ActivityClient.activityStopped(ActivityClient.java:84)
                                         	at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:143) 
                                         	at android.os.Handler.handleCallback(Handler.java:938) 
                                         	at android.os.Handler.dispatchMessage(Handler.java:99) 
                                         	at android.os.Looper.loopOnce(Looper.java:201) 
                                         	at android.os.Looper.loop(Looper.java:288) 
                                         	at android.app.ActivityThread.main(ActivityThread.java:7870) 
                                         	at java.lang.reflect.Method.invoke(Native Method) 
                                         	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
                                         	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
@jacobtabak jacobtabak added the bug 🪲 Something isn't working label Aug 22, 2024
@kiryldz
Copy link
Contributor

kiryldz commented Aug 27, 2024

@jacobtabak although this is a valid issue and we'll try to think what could be improved here, please keep in mind that we recommend using your own remember when working with large amounts of data. Can you try this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working compose
Projects
None yet
Development

No branches or pull requests

3 participants