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

OfflineRegionObserver stops delivering status updates without an error #1910

Closed
Guardiola31337 opened this issue Apr 24, 2019 · 3 comments · Fixed by #1895
Closed

OfflineRegionObserver stops delivering status updates without an error #1910

Guardiola31337 opened this issue Apr 24, 2019 · 3 comments · Fixed by #1895

Comments

@Guardiola31337
Copy link
Contributor

Following up from mapbox/mapbox-gl-native#14485 - integrating offline maps downstream in mapbox-navigation-android 👀 #1895 we've noticed a weird scenario when calling createOfflineRegion within MapOfflineManager

offlineManager.createOfflineRegion(definition, metadata, new CreateOfflineRegionCallback(callback));
Every time we try to download a geometry only dowloads 47 resources 👀

04-24 16:27:55.078 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 2/819 resources; 10288 bytes downloaded.
04-24 16:27:55.133 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 3/829 resources; 10850 bytes downloaded.
04-24 16:27:55.192 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 4/829 resources; 14575 bytes downloaded.
04-24 16:27:55.192 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 5/829 resources; 18237 bytes downloaded.
04-24 16:27:55.202 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 6/829 resources; 298553 bytes downloaded.
04-24 16:27:55.238 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 7/829 resources; 421255 bytes downloaded.
04-24 16:27:55.265 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 8/829 resources; 477234 bytes downloaded.
04-24 16:27:55.349 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 9/829 resources; 514041 bytes downloaded.
04-24 16:27:55.376 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 10/829 resources; 552876 bytes downloaded.
04-24 16:27:55.391 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 11/829 resources; 588021 bytes downloaded.
04-24 16:27:55.421 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 12/829 resources; 620212 bytes downloaded.
04-24 16:27:55.434 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 13/829 resources; 645285 bytes downloaded.
04-24 16:27:55.449 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 14/829 resources; 784758 bytes downloaded.
04-24 16:27:55.465 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 15/829 resources; 784821 bytes downloaded.
04-24 16:27:55.485 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 16/829 resources; 787544 bytes downloaded.
04-24 16:27:55.513 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 17/829 resources; 787607 bytes downloaded.
04-24 16:27:55.546 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 18/829 resources; 787670 bytes downloaded.
04-24 16:27:55.579 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 19/829 resources; 787733 bytes downloaded.
04-24 16:27:55.618 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 20/829 resources; 787796 bytes downloaded.
04-24 16:27:55.675 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 21/829 resources; 787859 bytes downloaded.
04-24 16:27:55.726 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 22/829 resources; 787922 bytes downloaded.
04-24 16:27:55.746 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 23/829 resources; 788287 bytes downloaded.
04-24 16:27:55.816 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 24/829 resources; 788350 bytes downloaded.
04-24 16:27:55.836 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 25/829 resources; 788413 bytes downloaded.
04-24 16:27:55.870 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 26/829 resources; 788476 bytes downloaded.
04-24 16:27:55.883 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 27/829 resources; 788539 bytes downloaded.
04-24 16:27:55.909 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 28/829 resources; 788602 bytes downloaded.
04-24 16:27:55.923 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 29/829 resources; 788665 bytes downloaded.
04-24 16:27:55.936 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 30/829 resources; 788728 bytes downloaded.
04-24 16:27:55.950 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 31/829 resources; 792154 bytes downloaded.
04-24 16:27:55.964 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 32/829 resources; 792217 bytes downloaded.
04-24 16:27:55.978 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 33/829 resources; 792280 bytes downloaded.
04-24 16:27:55.992 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 34/829 resources; 792343 bytes downloaded.
04-24 16:27:56.016 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 35/829 resources; 792406 bytes downloaded.
04-24 16:27:56.029 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 36/829 resources; 792469 bytes downloaded.
04-24 16:27:56.044 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 37/829 resources; 792532 bytes downloaded.
04-24 16:27:56.058 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 38/829 resources; 792595 bytes downloaded.
04-24 16:27:56.080 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 39/829 resources; 792658 bytes downloaded.
04-24 16:27:56.108 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 40/829 resources; 792721 bytes downloaded.
04-24 16:27:56.128 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 41/829 resources; 792784 bytes downloaded.
04-24 16:27:56.141 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 42/829 resources; 792847 bytes downloaded.
04-24 16:27:56.159 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 43/829 resources; 792910 bytes downloaded.
04-24 16:27:56.179 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 44/829 resources; 792973 bytes downloaded.
04-24 16:27:56.195 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 45/829 resources; 793036 bytes downloaded.
04-24 16:27:56.227 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 46/829 resources; 793099 bytes downloaded.
04-24 16:27:56.253 1955-1955/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 47/829 resources; 793162 bytes downloaded.

and stops so the download isn't fully completed and OfflineRegionDownloadCallback#onComplete callback is never called. It seems that the OfflineRegionObserver gets garbage collected somehow and stops giving status updates back.

This can be reproduced using https://github.com/mapbox/mapbox-gl-native/tree/pg-downstream-module after updating https://github.com/mapbox/mapbox-gl-native/blob/3192dda04a49f642f0622d171bc2ddf42bdddfca/platform/android/MapboxGLDownstreamTestApp/src/main/res/values/strings.xml#L6 side-loading an offline region nearby where you're going to drive and point to the right directory in https://github.com/mapbox/mapbox-gl-native/blob/3192dda04a49f642f0622d171bc2ddf42bdddfca/platform/android/MapboxGLDownstreamTestApp/src/main/java/com/mapbox/mapboxsdk/downstream/testapp/NavigationLauncherActivity.java#L362 and grant permissions "manually" from the app's settings before running the example.

We've also noticed that trying to download a geometry within OfflineRegionDownloadActivity

val geometry: Geometry = GeometryGeoJson.fromJson("{\"type\":\"Polygon\",\"coordinates\":[[[-77.152533,39.085537],[-77.152533,39.083038],[-77.150031,39.083038],[-77.150031,39.085537],[-77.147529,39.085537],[-77.147529,39.088039],[-77.147529,39.090538],[-77.150031,39.090538],[-77.150031,39.093037],[-77.150031,39.095539],[-77.150031,39.098038],[-77.150031,39.100540],[-77.150031,39.103039],[-77.152533,39.103039],[-77.152533,39.105537],[-77.155028,39.105537],[-77.155028,39.108040],[-77.155028,39.110538],[-77.157531,39.110538],[-77.157531,39.113037],[-77.160033,39.113037],[-77.160033,39.115536],[-77.162528,39.115540],[-77.162528,39.118038],[-77.165030,39.118038],[-77.165030,39.115536],[-77.167533,39.115536],[-77.167533,39.113037],[-77.167533,39.110538],[-77.165030,39.110538],[-77.165030,39.108040],[-77.162536,39.108036],[-77.162536,39.105537],[-77.162536,39.103039],[-77.160033,39.103039],[-77.160033,39.100540],[-77.157531,39.100536],[-77.157531,39.098038],[-77.157531,39.095535],[-77.157531,39.093037],[-77.157531,39.090538],[-77.157531,39.088039],[-77.155036,39.088036],[-77.155036,39.085537],[-77.152533,39.085537]]]}")
val definition: OfflineGeometryRegionDefinition = OfflineGeometryRegionDefinition(
styleUrl, geometry, minZoom, maxZoom, pixelRatio)
offlineManager.createOfflineRegion(definition, metadata, offlineRegionCallback)
it works as expected and we're not experiencing above-described issue. That made us think that could be related to the lifecycle / how it's consumed downstream in the Navigation SDK but we've tested a bunch of alternatives and always getting that behavior 😥 It'd be great if you could take a look at it and get your insights / thoughts on what could be causing this because we're running out of ideas.

cc @danesfeder @zugaldia @tobrun

@Guardiola31337
Copy link
Contributor Author

We've also tested with the LatLngBounds and OfflineTilePyramidRegionDefinition alternative 👀

LatLngBounds bounds = LatLngBounds.from(39.118620952596984, -77.16631710029368, 39.1094262639771, -77.17816757484755);
OfflineTilePyramidRegionDefinition definition = new OfflineTilePyramidRegionDefinition("mapbox://styles/mapbox/navigation-guidance-day-v4", bounds, 11, 17, 3);

but sadly we're experiencing the same, it stops after downloading the 47 resource, pretty weird 😞

04-24 17:52:49.927 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 2/798 resources; 10288 bytes downloaded.
04-24 17:52:49.987 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 3/808 resources; 10850 bytes downloaded.
04-24 17:52:50.002 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 4/808 resources; 14575 bytes downloaded.
04-24 17:52:50.017 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 5/808 resources; 18237 bytes downloaded.
04-24 17:52:50.030 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 6/808 resources; 298553 bytes downloaded.
04-24 17:52:50.048 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 7/808 resources; 421255 bytes downloaded.
04-24 17:52:50.172 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 8/808 resources; 477234 bytes downloaded.
04-24 17:52:50.267 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 9/808 resources; 514041 bytes downloaded.
04-24 17:52:50.270 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 10/808 resources; 552876 bytes downloaded.
04-24 17:52:50.280 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 11/808 resources; 588021 bytes downloaded.
04-24 17:52:50.314 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 12/808 resources; 620212 bytes downloaded.
04-24 17:52:50.349 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 13/808 resources; 645285 bytes downloaded.
04-24 17:52:50.355 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 14/808 resources; 784758 bytes downloaded.
04-24 17:52:50.394 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 15/808 resources; 784821 bytes downloaded.
04-24 17:52:50.411 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 16/808 resources; 787544 bytes downloaded.
04-24 17:52:50.428 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 17/808 resources; 787607 bytes downloaded.
04-24 17:52:50.456 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 18/808 resources; 787670 bytes downloaded.
04-24 17:52:50.470 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 19/808 resources; 787733 bytes downloaded.
04-24 17:52:50.484 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 20/808 resources; 787796 bytes downloaded.
04-24 17:52:50.511 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 21/808 resources; 787859 bytes downloaded.
04-24 17:52:50.529 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 22/808 resources; 787922 bytes downloaded.
04-24 17:52:50.563 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 23/808 resources; 788287 bytes downloaded.
04-24 17:52:50.575 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 24/808 resources; 788350 bytes downloaded.
04-24 17:52:50.598 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 25/808 resources; 788413 bytes downloaded.
04-24 17:52:50.625 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 26/808 resources; 788476 bytes downloaded.
04-24 17:52:50.643 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 27/808 resources; 788539 bytes downloaded.
04-24 17:52:50.661 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 28/808 resources; 788602 bytes downloaded.
04-24 17:52:50.680 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 29/808 resources; 788665 bytes downloaded.
04-24 17:52:50.700 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 30/808 resources; 788728 bytes downloaded.
04-24 17:52:50.728 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 31/808 resources; 792154 bytes downloaded.
04-24 17:52:50.745 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 32/808 resources; 792217 bytes downloaded.
04-24 17:52:50.765 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 33/808 resources; 792280 bytes downloaded.
04-24 17:52:50.790 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 34/808 resources; 792343 bytes downloaded.
04-24 17:52:50.825 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 35/808 resources; 792406 bytes downloaded.
04-24 17:52:50.857 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 36/808 resources; 792469 bytes downloaded.
04-24 17:52:50.876 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 37/808 resources; 792532 bytes downloaded.
04-24 17:52:50.907 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 38/808 resources; 792595 bytes downloaded.
04-24 17:52:50.939 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 39/808 resources; 792658 bytes downloaded.
04-24 17:52:50.978 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 40/808 resources; 792721 bytes downloaded.
04-24 17:52:51.008 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 41/808 resources; 792784 bytes downloaded.
04-24 17:52:51.044 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 42/808 resources; 792847 bytes downloaded.
04-24 17:52:51.058 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 43/808 resources; 792910 bytes downloaded.
04-24 17:52:51.080 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 44/808 resources; 792973 bytes downloaded.
04-24 17:52:51.094 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 45/808 resources; 793036 bytes downloaded.
04-24 17:52:51.108 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 46/808 resources; 793099 bytes downloaded.
04-24 17:52:51.135 3079-3079/com.mapbox.mapboxsdk.downstream.testapp I/System.out: DEBUG 47/808 resources; 793162 bytes downloaded.

cc @zugaldia

@Guardiola31337
Copy link
Contributor Author

Forgot to mention that we've also tried to set a higher tiles limit via OfflineManager#setOfflineMapboxTileCountLimit

// TODO Tried setting a higher limit
//offlineManager.setOfflineMapboxTileCountLimit(1000000);
without luck either.

@tobrun tobrun transferred this issue from mapbox/mapbox-gl-native Apr 25, 2019
@tobrun
Copy link
Member

tobrun commented Apr 25, 2019

Validated that issue stems from setting connectivity state to false:
https://github.com/mapbox/mapbox-navigation-android/blob/dan-offline-maps-ui/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationOfflineDatabaseCallback.java#L22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants