Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[Android] Invalid LatLng bounds in OfflineRegion causes JNI failure #8514

Closed

Description

@tikimcfee

Platform: Android
Mapbox SDK version: 4.2.2
Device: Nexus 4, Android 5.1.1

Hey there guys. This is a big one that I've just come across in 4.2.2. Unfortunately, all I have is a stack trace for you, and I can't test (or really reproduce this) on to 5.0.0 to try out because of #8497 .

From what I can tell, this was the flow:

  1. Fired up an offline region to download with a specific style (one of our own)
  2. Started bouncing around our app to test something map related (just display a map in this case)
  3. When it came time to show the map, the error: "failed to load style (timeout)" came up, and the callback for 'onMapReady' never hit.
  4. Without the mapboxMap from onMapReady, one of my features crashed.
  5. On loading up the app again and trying to figure out why I didn't have the mapboxMap instance, the app crashed a few seconds later (while trying to download an offline region) in the JNI stack.

The stack trace is here: https://gist.github.com/tikimcfee/c2da09cc0ffa7d7866a56bd28887a5d1

A little worried about this one, as we use offline regions pretty extensively and need to understand how this might affect our launch of our new feature set. Any help is greatly appreciated!

Activity

  1. tikimcfee commented on Mar 23, 2017

    @tikimcfee
    Author

    Got some more info for ya. So I'm running through our offline manager for the OfflineManager (hah), and this region seems to be causing the problem:

    result = {OfflineRegion@5490} 
     deliverInactiveMessages = false
     handler = null
     mDefinition = {OfflineTilePyramidRegionDefinition@5649} 
      bounds = {LatLngBounds@5697} "N:280.3236390895836; E:170.39092498779397; S:-223.2131089572934; W:-333.145823059083"
       mLatNorth = 280.3236390895836
       mLatSouth = -223.2131089572934
       mLonEast = 170.39092498779397
       mLonWest = -333.145823059083
       shadow$_klass_ = {Class@3770} "class com.mapbox.mapboxsdk.geometry.LatLngBounds"
       shadow$_monitor_ = -1726110723
      maxZoom = 18.0
      minZoom = 14.0
      pixelRatio = 2.0
      styleURL = "mapbox://styles/sightplan/cj0in7vok003a2smn9t3bcdtc"
      shadow$_klass_ = {Class@3787} "class com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition"
      shadow$_monitor_ = -2048837860
     mId = 1
     mMetadata = {byte[147]@5650} 
     mOfflineRegionPtr = 3080973160
     offlineManager = {OfflineManager@5651} 
     state = 0
     shadow$_klass_ = {Class@3785} "class com.mapbox.mapboxsdk.offline.OfflineRegion"
     shadow$_monitor_ = -1336214218
    

    Check out those whacky bounds, eh? Not sure how that happened. I double-triple checked that the coordinates we're feeding in for the lat-lng bounds are good, and it does indeed seem to be. I'll dig a little deeper to see what else I can find.

  2. tikimcfee commented on Mar 23, 2017

    @tikimcfee
    Author

    Aha! Dev failure for the win. Turns out it absolutely was my fault - I had a very simple calculation problem when creating the LatLng bounds for the offline region.

    So it looks like this is repairable on our end, but it definitely still seems like an issue that could impact users of the SDK. Maybe having some simple exception thrown when the bounds are detected to be invalid?

  3. changed the title [-][Critical][Android] Failure in style loading causes JNI crash[/-] [+][Android] Invalid LatLng bounds causes JNI failure[/+] on Mar 23, 2017
  4. changed the title [-][Android] Invalid LatLng bounds causes JNI failure[/-] [+][Android] Invalid LatLng bounds in OfflineRegion causes JNI failure[/+] on Mar 23, 2017
  5. added
    Android
    on Mar 24, 2017
  6. self-assigned this
    on Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Androidoffline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions