mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
622 stars 319 forks source link

MapboxNavigationNotification#updateNotificationViews TransactionTooLargeException #1188

Open Guardiola31337 opened 6 years ago

Guardiola31337 commented 6 years ago

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 commented 6 years ago

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

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

danesfeder commented 6 years ago

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

Danny-James commented 6 years ago

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

danesfeder commented 6 years ago

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

Guardiola31337 commented 6 years ago

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 🙏

danesfeder commented 6 years ago

We are still seeing this issue in the latest snapshot.

Guardiola31337 commented 6 years ago

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 😥

emilefleming commented 6 years ago

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

hurrba commented 5 years ago

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)
danesfeder commented 5 years ago

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.

stale[bot] commented 4 years ago

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.

Guardiola31337 commented 4 years ago

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

stale[bot] commented 4 years ago

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.

palimad commented 3 years ago

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

stale[bot] commented 2 years ago

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.