pappes / MyMovieSearch

test android app using flutter
GNU General Public License v3.0
1 stars 0 forks source link

restoration state data causing application to crash on return from web browser #81

Open pappes opened 9 months ago

pappes commented 9 months ago

with current restorations keys and data the app will crash with 123 -> pelham 123-> Denzel -> actor -> book of eli -> ratings

bumping up restoration id to 80,000 chars can invoke a crash using 123 -> pelham 123-> ratings

bumping up restoration id to 30,000 chars can invoke a crash using 123 -> pelham 123-> suggestions -> book of eli -> ratings

This shows that too much restoration data invokes a similar/same error. using string hashes for keys has not helped Theory: write data out to filestorage and use restoration to read data from file storage to allow for a deeper call stack without crashing.

pappes commented 9 months ago

code to increase restoration key to provoke the crash

/// Get a unique identifier for this data. /// static String getRestorationId(GoRouterState state) { final criteria = state.extra; String? id; if (criteria != null && criteria is MovieResultDTO) { id = criteria.uniqueId; } return '_${state.fullPath}$id'.hashCode.toString().padRight(17000, '0'); // 0+0+suggestions = safe // 10+10+suggestions = safe // 15+15+suggestions = safe // 17+17+suggestions = safe // 17+17+suggestions = 1,911,152 bytes // 20+20+suggestions = 1,699,552 bytes // 30+30+suggestions = 1,909,848 bytes // 70,000 = safe // 80,000 = 796,764 bytes //800,000 = 1,619,156 bytes //880,000 = 1,779,156 bytes bytes }

pappes commented 9 months ago

debugger exceptionlog

E/AndroidRuntime(25077): Bundle stats: E/AndroidRuntime(25077): framework [size=2943152] E/AndroidRuntime(25077): PersistableBundle stats: E/AndroidRuntime(25077): [null] E/AndroidRuntime(25077): at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:146) E/AndroidRuntime(25077): at android.os.Handler.handleCallback(Handler.java:958) E/AndroidRuntime(25077): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(25077): at android.os.Looper.loopOnce(Looper.java:205) E/AndroidRuntime(25077): at android.os.Looper.loop(Looper.java:294) E/AndroidRuntime(25077): at android.app.ActivityThread.main(ActivityThread.java:8194) E/AndroidRuntime(25077): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(25077): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) E/AndroidRuntime(25077): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) E/AndroidRuntime(25077): Caused by: android.os.TransactionTooLargeException: data parcel size 2944044 bytes E/AndroidRuntime(25077): at android.os.BinderProxy.transactNative(Native Method) E/AndroidRuntime(25077): at android.os.BinderProxy.transact(BinderProxy.java:584) E/AndroidRuntime(25077): at android.app.IActivityClientController$Stub$Proxy.activityStopped(IActivityClientController.java:1439) E/AndroidRuntime(25077): at android.app.ActivityClient.activityStopped(ActivityClient.java:96) E/AndroidRuntime(25077): at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:135) E/AndroidRuntime(25077): ... 8 more I/Process (25077): Sending signal. PID: 25077 SIG: 9

pappes commented 6 months ago

DTO restoration and goroute state data has been reduced but still experiencing crashing with many nested routes.

Suggest examining latest options in go_route for custom serialization/rdeserialization https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/extra_codec.dart context.go('/', extra: ComplexData1('data')) to see if that reduces the restoration payload size

recent commits reducing restoration data https://github.com/pappes/MyMovieSearch/commit/3515b1b1f669235e98628844fcff8ff984aa2337 https://github.com/pappes/MyMovieSearch/commit/898f4577cd4a66b49f742a198ae1bdd6a4c4f169 https://github.com/pappes/MyMovieSearch/commit/a3cb0126cb7a034c1a821cac1ab7f6d2616c350f