mapbox-gl-native-android icon indicating copy to clipboard operation
mapbox-gl-native-android copied to clipboard

Offline Region download gets canceled

Open domenik-graphmasters opened this issue 4 years ago • 3 comments

Mapbox SDK version: 9.2.0

Steps to reproduce

  • Create a Offline Region definition with minZoom = 9.0 and maxZoom = 25.0
  • Call OfflineManager.createOfflineRegion with the newly created definition
  • In CreateOfflineRegionCallback.onCreate set the download state of the newly created OfflineRegion to OfflineRegion.STATE_ACTIVE
  • After a few seconds the download gets canceled

Expected behaviour Depending on what exactly the issue is, I would expect a call to onError() from OfflineRegion.OfflineRegionObserver with a meaningful error message. Or I would expect the download to finish without errors.

Actual behaviour

After starting the download some progress is made. Shortly after the download is canceled with the following log. There is no call of the onError() or mapboxTileCountLimitExceeded() from OfflineRegion.OfflineRegionObserver. The download can not be restarted.

2020-06-11 10:20:40.695 16028-16158 D/Mbgl-HttpRequest: [HTTP] Cancel request https://<company-proxy>/graphmasters.b1o7idq9,mapbox.mapbox-streets-v7,mapbox.mapbox-terrain-v2/15/17256/10680.vector.pbf?access_token=<removed>

[...]

2020-06-11 10:21:17.437 16028-16158 D/Mbgl-HttpRequest: [HTTP] Cancel request https://<company-proxy>/graphmasters.b1o7idq9,mapbox.mapbox-streets-v7,mapbox.mapbox-terrain-v2/15/17259/10738.vector.pbf?access_token=<removed>
2020-06-11 10:21:17.438 16028-16312 W/Mbgl-HttpRequest: Request failed due to a permanent error: Canceled 
2020-06-11 10:21:17.438 16028-16199 W/Mbgl-HttpRequest: Request failed due to a permanent error: Canceled 
2020-06-11 10:21:17.438 16028-16238 W/Mbgl-HttpRequest: Request failed due to a permanent error: Canceled 
2020-06-11 10:21:17.438 16028-16197 W/Mbgl-HttpRequest: Request failed due to a permanent error: Canceled 
2020-06-11 10:21:17.438 16028-16231 W/Mbgl-HttpRequest: Request failed due to a permanent error: Canceled 

domenik-graphmasters avatar Jun 11 '20 09:06 domenik-graphmasters

I'm experiencing the same on Mapbox SDK 9.5.1. Reverting to 9.1.0 fixes the issue.

I don't get any logcat output, but I can see when profiling that the request is cancelled within a few milliseconds.

image

This can occur on a fresh install of the app with not much tile data populating the database before the request to offline the region is called (i.e. it doesn't already have all of the tiles for the region).

When debugging I get 1 callback to onStatusChange where the OfflineRegionStatus has requiredResourceCount 1, requiredResourceCountIsPrecise false and downloadState 1 (rest of the fields are 0).

And then nothing. No further callbacks to onStatusChange, onError or mapboxTileCountLimitExceeded

JRWilding avatar Nov 05 '20 16:11 JRWilding

After more testing, sometimes there is a 2nd callback to onStatusChange where the requiredResourceCount is set correctly (~3000 in my case), requiredResourceCountIsPrecise is true but the downloadState has been set to 0.

JRWilding avatar Nov 06 '20 12:11 JRWilding

Any progress? I'm experiencing the same issue. I get several progress calls, up to ~8% but then everything stops. No error received.

david-kooi avatar Sep 30 '21 17:09 david-kooi