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: RouteController.updateIndexes(status:progress:) #3298

Closed
dmiluski opened this issue Aug 25, 2021 · 16 comments · Fixed by #3652
Closed

Crash: RouteController.updateIndexes(status:progress:) #3298

dmiluski opened this issue Aug 25, 2021 · 16 comments · Fixed by #3652
Assignees
Labels
bug Something isn’t working Core Work related to core navigation and integrations. P1 Not critical, but rather to be done soon.
Milestone

Comments

@dmiluski
Copy link

Experiencing Crash using Nav SDK
Currently our top crasher
Device States: 21% occurs in background

Crashed: com.apple.main-thread
0  Straightaway                   0x10109a910 RouteController.updateIndexes(status:progress:) + 4347160848
1  Straightaway                   0x101099f54 RouteController.update(to:) + 4347158356
2  Straightaway                   0x1010a0104 partial apply for closure #1 in RouteController.navigationStatusDidChange(_:) + 4347183364
3  Straightaway                   0x1010571d8 thunk for @escaping @callee_guaranteed () -> () + 4346884568
4  libdispatch.dylib              0x1804e1a84 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x1804e381c _dispatch_client_callout + 20
6  libdispatch.dylib              0x1804f1c70 _dispatch_main_queue_callback_4CF + 884
7  CoreFoundation                 0x180870340 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
8  CoreFoundation                 0x18086a218 __CFRunLoopRun + 2524
9  CoreFoundation                 0x180869308 CFRunLoopRunSpecific + 600
10 GraphicsServices               0x197eec734 GSEventRunModal + 164
11 UIKitCore                      0x1832e775c -[UIApplication _run] + 1072
12 UIKitCore                      0x1832ecfcc UIApplicationMain + 168
13 Straightaway                   0x100b71f1c main + 12 (AppDelegate.swift:12)
14 libdyld.dylib                  0x180525cf8 start + 4

Mapbox Navigation SDK version:

    "package": "MapboxNavigation",
    "repositoryURL": "https://github.com/mapbox/mapbox-navigation-ios",
    "state": {
      "branch": null,
      "revision": "40b17184f7b67f0019121cdedad190df55b9ea00",
      "version": "2.0.0-beta.21"
    }

Steps to reproduce

Found in Crashlytics

Expected behavior

Not Crash

Actual behavior

Crashes

@1ec5
Copy link
Contributor

1ec5 commented Sep 21, 2021

Are you still seeing this crash after upgrading to v2.0.0-rc.1 or above? We’ve made some changes to route and route progress management that could resolve it.

@1ec5 1ec5 added - crash needs more information Can't proceed without more data. labels Sep 21, 2021
@dmiluski
Copy link
Author

dmiluski commented Sep 21, 2021

Hi @1ec5 ,

Our last release was pinned to this beta due to a regression in RC. Given latest RC2 addressed the regression, we will be included in our upcoming release, I'll keep this in mind to review.

      {
        "package": "MapboxNavigation",
        "repositoryURL": "https://github.com/mapbox/mapbox-navigation-ios.git",
        "state": {
          "branch": null,
          "revision": "6b1bdd37ef28a3df658569dfcb2c5ed3b9aac1d5",
          "version": "2.0.0-beta.22"
        }
      },

@truburt truburt removed the - crash label Sep 29, 2021
@dmiluski
Copy link
Author

@1ec5 yes, we are still seeing this

      {
        "package": "MapboxNavigation",
        "repositoryURL": "https://github.com/mapbox/mapbox-navigation-ios.git",
        "state": {
          "branch": null,
          "revision": "8257c395745e18255e391978e387034f00086290",
          "version": "2.0.0-rc.3"
        }
      },
Crashed: com.apple.main-thread
0  Straightaway                   0x102ac074c RouteController.updateIndexes(status:progress:) + 4305389388 (RouteController.swift:4305389388)
1  Straightaway                   0x102abfb5c RouteController.update(to:) + 4305386332 (<compiler-generated>:4305386332)
2  Straightaway                   0x102ac60a0 partial apply for closure #1 in RouteController.navigationStatusDidChange(_:) + 4305412256 (<compiler-generated>:4305412256)
3  Straightaway                   0x102a739b8 thunk for @escaping @callee_guaranteed () -> () + 4305074616 (<compiler-generated>:4305074616)
4  libdispatch.dylib              0x18090fc04 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x180911950 _dispatch_client_callout + 20
6  libdispatch.dylib              0x18091fd30 _dispatch_main_queue_callback_4CF + 940
7  CoreFoundation                 0x180c57ce4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
8  CoreFoundation                 0x180c11ebc __CFRunLoopRun + 2540
9  CoreFoundation                 0x180c253c8 CFRunLoopRunSpecific + 600
10 GraphicsServices               0x19c43638c GSEventRunModal + 164
11 UIKitCore                      0x1835cb0bc -[UIApplication _run] + 1100
12 UIKitCore                      0x183348be8 UIApplicationMain + 2124
13 Straightaway                   0x1025716b8 main + 12 (AppDelegate.swift:12)
14 ???                            0x103829a24 (Missing)

https://console.firebase.google.com/u/1/project/driver-1527025761813/crashlytics/app/ios:com.zacharyblank.Driver/issues/372c88915195e45037ba3d43cfcc919d?time=last-seven-days&versions=2.31.0%20(6616)&sessionEventKey=2daf1096f0544bb6b51c95fdf42e771f_1591815887435660920

@ShanMa1991
Copy link
Contributor

Hi @dmiluski , would you mind providing more details about this crash?

  1. Is this crash happened just after or before the arrival of one waypoint, and then we need to advance to the next leg? If so, are you handling with the leg advance with router.advanceLegIndex() and then the navigationService.start(), or something else? Because we observed this kind of crash when the users use the router.routeProgress.legIndex += 1 to advance route leg.
  2. Is this crash happened under simulation mode without real world driving, or it happened during the real world driving? Because the mapView.location.locationProvider would provide background location update which may interfere with the navigator, and trigger rerouting or refresh event during the simulation mode to update indexes.

@dmiluski
Copy link
Author

dmiluski commented Sep 29, 2021

I have yet to repro in simulator. Each of these crash reports is being seen by end users of our production app. Happy to share more details of the crash reports/access offline.

Reviewing the attached event logs, I'm unfortunately not able to see a consistent sequence of events leading up to the crash:

Appears to be a mix of iOS 14.x/15.x so nothing iOS version specific

Some examples:

  • User starts Navigation, backgrounds, and returns to app
  • User foregrounds the app and starts navigation
  • App Launched, then navigation started

@dmiluski
Copy link
Author

dmiluski commented Sep 30, 2021

Attaching Clearer symbolicated crash trace from Xcode

cc @ShanMa1991

      {
        "package": "MapboxNavigation",
        "repositoryURL": "https://github.com/mapbox/mapbox-navigation-ios.git",
        "state": {
          "branch": null,
          "revision": "8257c395745e18255e391978e387034f00086290",
          "version": "2.0.0-rc.3"
        }
      },

Screen Shot 2021-09-30 at 9 18 58 AM

@dmiluski
Copy link
Author

Thread 0 name:
Thread 0 Crashed:
0   Straightaway                  	0x000000010259c74c Swift runtime failure: precondition failure + 0 (RouteController.swift:0)
1   Straightaway                  	0x000000010259c74c specialized Range.contains(_:) + 0 (RouteController.swift:339)
2   Straightaway                  	0x000000010259c74c RouteController.updateIndexes(status:progress:) + 732 (RouteController.swift:339)
3   Straightaway                  	0x000000010259c528 RouteLegProgress.stepIndex.getter + 20 (<compiler-generated>:0)
4   Straightaway                  	0x000000010259c528 RouteController.updateIndexes(status:progress:) + 184 (RouteController.swift:338)
5   Straightaway                  	0x000000010259bb5c RouteController.update(to:) + 500 (RouteController.swift:283)
6   Straightaway                  	0x00000001025a20a0 closure #1 in RouteController.navigationStatusDidChange(_:) + 48 (RouteController.swift:271)
7   Straightaway                  	0x00000001025a20a0 partial apply for closure #1 in RouteController.navigationStatusDidChange(_:) + 68 (<compiler-generated>:0)
8   Straightaway                  	0x000000010254f9b8 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:0)
9   libdispatch.dylib             	0x00000001a6195a84 _dispatch_call_block_and_release + 32 (init.c:1466)
10  libdispatch.dylib             	0x00000001a619781c _dispatch_client_callout + 20 (object.m:559)
11  libdispatch.dylib             	0x00000001a61a5c70 _dispatch_main_queue_callback_4CF + 884 (inline_internal.h:2557)
12  CoreFoundation                	0x00000001a6524a2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1790)
13  CoreFoundation                	0x00000001a651e904 __CFRunLoopRun + 2524 (CFRunLoop.c:3118)
14  CoreFoundation                	0x00000001a651d9f4 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
15  GraphicsServices              	0x00000001bdbee734 GSEventRunModal + 164 (GSEvent.c:2259)
16  UIKitCore                     	0x00000001a8f9b75c -[UIApplication _run] + 1072 (UIApplication.m:3269)
17  UIKitCore                     	0x00000001a8fa0fcc UIApplicationMain + 168 (UIApplication.m:4740)
18  Straightaway                  	0x000000010204d6b8 main + 68 (AppDelegate.swift:12)
19  libdyld.dylib                 	0x00000001a61d9cf8 start + 4

@Udumft Udumft self-assigned this Oct 1, 2021
@Udumft
Copy link
Contributor

Udumft commented Oct 4, 2021

This issue most likely will be resolved in #3343

@S2Ler
Copy link
Contributor

S2Ler commented Oct 12, 2021

Fixed in #3432

@dmiluski Please reopen if you see the crash after updating to upcoming this week release.

@S2Ler S2Ler closed this as completed Oct 12, 2021
@dmiluski
Copy link
Author

dmiluski commented Oct 27, 2021

Hi @S2Ler , @Udumft ,

We're currently in the process of a ramping release (2%) and noticed a crash that appears to show this still being an issue?

Release 2.33.0 - (7357)
https://github.com/mapbox/straightaway-ios/releases/tag/v2.33.0

Related Firebase Crash Log:
https://console.firebase.google.com/u/1/project/driver-1527025761813/crashlytics/app/ios:com.zacharyblank.Driver/issues/372c88915195e45037ba3d43cfcc919d?versions=2.33.0%20(7357)&time=last-seven-days

Apple/Xcode Crash reports will take a few days to come in to compare.

Using GM Release:

      {
        "package": "MapboxNavigation",
        "repositoryURL": "https://github.com/mapbox/mapbox-navigation-ios.git",
        "state": {
          "branch": null,
          "revision": "03523ae1a59e8949bf20fa09b2e6ee25ef5a05d5",
          "version": "2.0.0"
        }
      },

https://github.com/mapbox/straightaway-ios/blob/main/Straightaway.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@dmiluski dmiluski reopened this Oct 27, 2021
@S2Ler

This comment has been minimized.

@dmiluski

This comment has been minimized.

@S2Ler
Copy link
Contributor

S2Ler commented Nov 2, 2021

@1ec5 I'm not sure what else can cause a crash here. I'm inclining toward removing preconditions and just filtering out rogue status updates with some logs.

@S2Ler S2Ler modified the milestones: v2.0, v2.1-rc Nov 2, 2021
@S2Ler S2Ler added bug Something isn’t working and removed needs more information Can't proceed without more data. labels Nov 2, 2021
@S2Ler S2Ler added the P1 Not critical, but rather to be done soon. label Nov 2, 2021
@S2Ler S2Ler modified the milestones: v2.1-rc, v2.1 Nov 16, 2021
@MaximAlien MaximAlien added the Core Work related to core navigation and integrations. label Nov 29, 2021
@MaximAlien MaximAlien modified the milestones: v2.1, v2.2 Nov 29, 2021
@MaximAlien
Copy link
Contributor

Linking #3542 as well (see second point in ticket description).

@dmiluski
Copy link
Author

dmiluski commented Dec 15, 2021

Including Crash report in case it helps @S2Ler @MaximAlien as this has been our top crasher for quite some time

2021-12-09_14-27-24.5682_-0500-5b36bfdc708c493b3bc26573db7be197a9534905.crash.zip

@dmiluski
Copy link
Author

Latest release still crashing:

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x0000000104dad854

Crashed: com.apple.main-thread
0  Straightaway                   0x5c5854 RouteController.updateIndexes(status:progress:) + 4346124372 (RouteController.swift:4346124372)
1  Straightaway                   0x5c4654 RouteController.update(to:) + 4346119764 (<compiler-generated>:4346119764)
2  Straightaway                   0x5c4468 RouteController.navigationStatusDidChange(_:) + 4346119272 (<compiler-generated>:4346119272)
3  Straightaway                   0x5c44d8 @objc RouteController.navigationStatusDidChange(_:) + 4346119384 (<compiler-generated>:4346119384)
4  CoreFoundation                 0x2aed8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
5  CoreFoundation                 0xc6b8c ___CFXRegistrationPost_block_invoke + 52
6  CoreFoundation                 0x99f44 _CFXRegistrationPost + 456
7  CoreFoundation                 0x40d44 _CFXNotificationPost + 716
8  Foundation                     0x1a628 -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
9  Straightaway                   0x566b98 Navigator.onStatus(for:status:) + 4345736088 (<compiler-generated>:4345736088)
10 Straightaway                   0x566c38 @objc Navigator.onStatus(for:status:) + 4345736248 (<compiler-generated>:4345736248)
11 MapboxNavigationNative         0x31f88 (Missing)
12 MapboxNavigationNative         0x248858 (Missing)
13 MapboxNavigationNative         0x2e5968 (Missing)
14 MapboxCoreMaps                 0xc5170 mbgl::util::RunLoop::process() + 2344 (memory:2344)
15 CoreFoundation                 0xbb020 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
16 CoreFoundation                 0xcbce0 __CFRunLoopDoSource0 + 208
17 CoreFoundation                 0x6054 __CFRunLoopDoSources0 + 376
18 CoreFoundation                 0xb7f4 __CFRunLoopRun + 820
19 CoreFoundation                 0x1f3b8 CFRunLoopRunSpecific + 600
20 GraphicsServices               0x138c GSEventRunModal + 164
21 UIKitCore                      0x5196a8 -[UIApplication _run] + 1100
22 UIKitCore                      0x2987f4 UIApplicationMain + 2092
23 Straightaway                   0x79c0 main + 13 (AppDelegate.swift:13)
24 ???                            0x106519a24 (Missing)

Package.resolved

      {
        "package": "MapboxCommon",
        "repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git",
        "state": {
          "branch": null,
          "revision": "3dabe41278e9b88e3eb2851dd3967493d21f08af",
          "version": "21.0.1"
        }
      },
      {
        "package": "MapboxCoreMaps",
        "repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
        "state": {
          "branch": null,
          "revision": "a9955a309b7d17ce743bb9ea2eaf259540a2f64a",
          "version": "10.2.0"
        }
      },
      {
        "package": "MapboxDirections",
        "repositoryURL": "https://github.com/mapbox/mapbox-directions-swift.git",
        "state": {
          "branch": null,
          "revision": "28a0bc98ca13ac7cbfa08d06f273dcd94503d696",
          "version": "2.2.0-alpha.1"
        }
      },
      {
        "package": "MapboxMobileEvents",
        "repositoryURL": "https://github.com/mapbox/mapbox-events-ios.git",
        "state": {
          "branch": null,
          "revision": "e29f48d9ed02b31ef51f9774a9c45f1d7c2c2b78",
          "version": "1.0.6"
        }
      },
      {
        "package": "MapboxMaps",
        "repositoryURL": "https://github.com/mapbox/mapbox-maps-ios.git",
        "state": {
          "branch": null,
          "revision": "f8f4bb51777d2062b171018ac738c87d1ec94c7a",
          "version": "10.2.0"
        }
      },
      {
        "package": "MapboxNavigation",
        "repositoryURL": "https://github.com/mapbox/mapbox-navigation-ios.git",
        "state": {
          "branch": null,
          "revision": "7e3cd76ab68f750b7c0c96e80417d9d35c3dce08",
          "version": "2.2.0-beta.1"
        }
      },
      {
        "package": "MapboxNavigationNative",
        "repositoryURL": "https://github.com/mapbox/mapbox-navigation-native-ios.git",
        "state": {
          "branch": null,
          "revision": "d5a735b20f34cc18a85b3f059c4613bd38da2dd6",
          "version": "82.0.1"
        }
      },
      {
        "package": "MapboxSpeech",
        "repositoryURL": "https://github.com/mapbox/mapbox-speech-swift.git",
        "state": {
          "branch": null,
          "revision": "b0a6008c184c1010dac11e14bf20afe4261d8c36",
          "version": "2.0.0"
        }
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working Core Work related to core navigation and integrations. P1 Not critical, but rather to be done soon.
Projects
None yet
7 participants