mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

MapboxNavigationNotification#updateNotificationViews TransactionTooLargeException

Open Guardiola31337 opened this issue 6 years ago • 15 comments

Run into the following 💥 while testing

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 524216 bytes
  at android.app.NotificationManager.notifyAsUser(NotificationManager.java:408)
  at android.app.NotificationManager.notify(NotificationManager.java:370)
  at android.app.NotificationManager.notify(NotificationManager.java:346)
  at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotificationViews(MapboxNavigationNotification.java:150)
  at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotification(MapboxNavigationNotification.java:72)
  at com.mapbox.services.android.navigation.v5.navigation.NavigationNotificationProvider.updateNavigationNotification(NavigationNotificationProvider.java:23)
  at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.java:33)
  at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorHandlerCallback$1.run(RouteProcessorHandlerCallback.java:97)
  at android.os.Handler.handleCallback(Handler.java:873)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:193)
  at android.app.ActivityThread.main(ActivityThread.java:6669)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.os.TransactionTooLargeException: data parcel size 524216 bytes
  at android.os.BinderProxy.transactNative(Native Method)
  at android.os.BinderProxy.transact(Binder.java:1127)
  at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:1558)
  at android.app.NotificationManager.notifyAsUser(NotificationManager.java:405)
  at android.app.NotificationManager.notify(NotificationManager.java:370) 
  at android.app.NotificationManager.notify(NotificationManager.java:346) 
  at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotificationViews(MapboxNavigationNotification.java:150) 
  at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotification(MapboxNavigationNotification.java:72) 
  at com.mapbox.services.android.navigation.v5.navigation.NavigationNotificationProvider.updateNavigationNotification(NavigationNotificationProvider.java:23) 
  at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.java:33) 
  at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorHandlerCallback$1.run(RouteProcessorHandlerCallback.java:97) 
  at android.os.Handler.handleCallback(Handler.java:873) 
  at android.os.Handler.dispatchMessage(Handler.java:99) 
  at android.os.Looper.loop(Looper.java:193) 
  at android.app.ActivityThread.main(ActivityThread.java:6669) 
  at java.lang.reflect.Method.invoke(Native Method) 
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

Guardiola31337 avatar Aug 06 '18 07:08 Guardiola31337

👀 https://github.com/mapbox/mapbox-navigation-android/issues/355

Noting that this happened in a Pixel XL running the beta of Android P.

Guardiola31337 avatar Aug 06 '18 07:08 Guardiola31337

We have seen this before - my hunch is it's related to updating a custom content view and custom content big view at the same time (every second). Something is getting "built-up" until this exception occurs. This custom content big view was re-added in #1059 cc @devotaaabel

danesfeder avatar Aug 06 '18 12:08 danesfeder

@Guardiola31337 @danesfeder has this been investigated since? I've also received this 💥 #1309

Danny-James avatar Sep 27 '18 09:09 Danny-James

It seems like data is being built-up with the View updates we make on every progress update > some more possible insight https://stackoverflow.com/questions/45087779/android-notification-manager-transactiontoolargeexception

danesfeder avatar Oct 03 '18 20:10 danesfeder

Hey @Danny-James 👋 we implemented some changes to fix OP in https://github.com/mapbox/mapbox-navigation-android/pull/1455 and are available in the recent 0.22.0 release version of the SDK.

Please keep an eye to your Crashlytics errors after upgrading to the latest version and let us know if you see the TransactionTooLargeException again. As commented in https://github.com/mapbox/mapbox-navigation-android/pull/1441#issuecomment-432703634 we're testing the new changes to keep supporting both collapsed and expanded layouts, if we reproduce we'll remove the expanded support (👀 #1441).

Thanks as always 🙏

Guardiola31337 avatar Oct 25 '18 09:10 Guardiola31337

We are still seeing this issue in the latest snapshot.

danesfeder avatar Oct 29 '18 18:10 danesfeder

As described in https://github.com/mapbox/mapbox-navigation-android/pull/1474#issuecomment-434629803 we need to keep digging into the source of this issue.

Apparently, it doesn't have to be caused by the notification per se and could be related to the amount of data stored in onSaveInstanceState so we should 🕵️ where we're adding too many data into a Bundle across the whole codebase and analyze / debug / test if that's raising the error.

Going ahead and reopening here 😥

Guardiola31337 avatar Oct 31 '18 10:10 Guardiola31337

I am also seeing this crash come up, let me know if there is any way I can help.

emilefleming avatar Nov 08 '18 17:11 emilefleming

Still noticing this issue on a regular basis. Latest trace below. I've also included device info in case that helps.

# Date: Mon Dec 10 2018 17:10:00 GMT+0100 (Central European Standard Time)

# Device:
Brand: samsung
Model: SM-G955F
Orientation: Portrait
RAM free: 952.48 MB
Disk free: 3.02 GB

# Operating System:
Version: 8.0.0
Orientation: Portrait
Rooted: No

# Trace:
Fatal Exception: java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 883520 bytes
       at android.app.NotificationManager.notifyAsUser(NotificationManager.java:353)
       at android.app.NotificationManager.notify(NotificationManager.java:297)
       at android.app.NotificationManager.notify(NotificationManager.java:281)
       at dk.hopper.hopper.navigation.CustomNavigationNotification.updateNotificationViews(CustomNavigationNotification.kt:157)
       at dk.hopper.hopper.navigation.CustomNavigationNotification.updateNotification(CustomNavigationNotification.kt:143)
       at com.mapbox.services.android.navigation.v5.navigation.NavigationNotificationProvider.updateNavigationNotification(NavigationNotificationProvider.java:23)
       at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.java:33)
       at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorRunnable$1.run(RouteProcessorRunnable.java:119)
       at android.os.Handler.handleCallback(Handler.java:789)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6938)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Caused by android.os.TransactionTooLargeException: data parcel size 883520 bytes
       at android.os.BinderProxy.transactNative(Binder.java)
       at android.os.BinderProxy.transact(Binder.java:761)
       at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:1317)
       at android.app.NotificationManager.notifyAsUser(NotificationManager.java:350)
       at android.app.NotificationManager.notify(NotificationManager.java:297)
       at android.app.NotificationManager.notify(NotificationManager.java:281)
       at dk.hopper.hopper.navigation.CustomNavigationNotification.updateNotificationViews(CustomNavigationNotification.kt:157)
       at dk.hopper.hopper.navigation.CustomNavigationNotification.updateNotification(CustomNavigationNotification.kt:143)
       at com.mapbox.services.android.navigation.v5.navigation.NavigationNotificationProvider.updateNavigationNotification(NavigationNotificationProvider.java:23)
       at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.java:33)
       at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorRunnable$1.run(RouteProcessorRunnable.java:119)
       at android.os.Handler.handleCallback(Handler.java:789)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6938)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

hurrba avatar Dec 11 '18 09:12 hurrba

Hey @hurrba, yeah we've been trying some different solutions (it's slow moving because we need to run navigation for hours to reproduce). This is top priority and aimed for next weeks release. Thanks for your patience. If you have any ideas about it, please let us know.

danesfeder avatar Dec 13 '18 16:12 danesfeder

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 15 '20 03:07 stale[bot]

Commenting here so stale bot doesn't remove this ticket as this is still sometimes reproducible 😅

Guardiola31337 avatar Jul 15 '20 18:07 Guardiola31337

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 09 '20 14:11 stale[bot]

I think this is caused by saving instance state for big routes

        directionRoute?.let {
            outState.putString(PRIMARY_ROUTE_BUNDLE_KEY, it.toJson())
        }

This should be persisted through viewmodel, repository or somehow else

palimad avatar Jun 23 '21 10:06 palimad

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 01 '22 01:05 stale[bot]