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

Crash while updating the Notification Views #94

Open
iboalali opened this issue Nov 7, 2023 · 4 comments
Open

Crash while updating the Notification Views #94

iboalali opened this issue Nov 7, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@iboalali
Copy link

iboalali commented Nov 7, 2023

Android: 7 - 13
Android API: 24 - 33
Maplibre Navigation SDK version: 2.0.0

Stacktrace

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 671536 bytes
  at android.app.NotificationManager.notifyAsUser(NotificationManager.java:700)
  at android.app.NotificationManager.notify(NotificationManager.java:632)
  at android.app.NotificationManager.notify(NotificationManager.java:608)
  at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotificationViews(MapboxNavigationNotification.java:173)
  at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotification(MapboxNavigationNotification.java:79)
  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:942)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:226)
  at android.os.Looper.loop(Looper.java:313)
  at android.app.ActivityThread.main(ActivityThread.java:8741)
  at java.lang.reflect.Method.invoke(Method.java:-2)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
  Caused by: android.os.TransactionTooLargeException: data parcel size 671536 bytes
    at android.os.BinderProxy.transactNative(BinderProxy.java:-2)
    at android.os.BinderProxy.transact(BinderProxy.java:653)
    at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:4011)
    at android.app.NotificationManager.notifyAsUser(NotificationManager.java:697)
    at android.app.NotificationManager.notify(NotificationManager.java:632)
    at android.app.NotificationManager.notify(NotificationManager.java:608)
    at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotificationViews(MapboxNavigationNotification.java:173)
    at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotification(MapboxNavigationNotification.java:79)
    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:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8741)
    at java.lang.reflect.Method.invoke(Method.java:-2)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
  • This same crash happens with different parcel size: 671536, 232436, 2088980,1039932 bytes and many others.
  • Using the default NavigationNotification implementation.

Steps to trigger behavior

  1. Start Navigation
  2. Navigate through the route
  3. Crash

Expected behavior

Updating notification without crash

Actual behavior

Crashing while updating notification

@Fabi755
Copy link
Collaborator

Fabi755 commented Nov 7, 2023

Thank's for your report!

Does this happen every time or only sometimes?

We will have a look at in the near future.

@Fabi755 Fabi755 added the bug Something isn't working label Nov 7, 2023
@iboalali
Copy link
Author

iboalali commented Nov 7, 2023

Only sometimes for now (a few dozens). Because we just release the new version widely this number will increase.

It did not occur while testing internally, only now with our customers

@Fabi755
Copy link
Collaborator

Fabi755 commented Feb 16, 2024

I see this same error on our app too. There exists a lot of Mapbox issues about this topic. The most mentioned cause is that the navigation view is growing with every update. So long time navigations are crashing with this error, while the notification is too big after (for example) 100 updates.

But I'm still working on a solution on this. But it's very hard to test and reproduce. Feel free to provide a solution to everyone.

@Fabi755 Fabi755 self-assigned this Feb 16, 2024
@iboalali
Copy link
Author

I just reduced the complexity of the notification with a custom implementation. It helped a lot, but didn't prevent the crashes.
My latest attempt is to wrap it with a try-catch for now, until we find a solution.

try {
    notificationManager.notify(NavigationConstants.NAVIGATION_NOTIFICATION_ID, notificationBuilder!!.build())
} catch (e: RuntimeException) {
    // to catch two different exceptions, TransactionTooLargeException and
    // DeadSystemException (API 24+) re-thrown as Runtime exception
    Timber.e(e)
}

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

No branches or pull requests

2 participants