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.

IOS: Offline pack is not working properly on next day when iPad is in offline. #9705

Closed

Description

Platform: IOS
Mapbox SDK version: 3.6.0

Steps to trigger behavior

  1. Download all the offline packs.
  2. Leave the device offline until tomorrow, or change the date time in device to tomorrow.
  3. Then the offline pack is not loading properly.

Expected behavior

  1. The offline pack's should work even after the device is in offline for more than 3 to 4 days.

Actual behavior

  1. But it's not working every time we need to come online.

We have client's who will work only in offline for more than 2 days. In that case the offline packs should work , but it's not working. I think the tiles are expiring every day.

Activity

  1. added
    iOS
    on Aug 4, 2017
  2. ThiyagarajanShivSankaran commented on Aug 8, 2017

    @ThiyagarajanShivSankaran
    Author

    Please download the video file from dropbox for further reference of this issue,

    https://www.dropbox.com/s/sdfs2y05ivrz9q3/mapbox%20offline%20pack%20issue.mov?dl=0

    But, I have checked the same scenario using the older SDK v3.5.4, it's working there.

  3. kkaefer commented on Aug 10, 2017

    @kkaefer
    Member

    @ThiyagarajanShivSankaran thanks for reporting this bug

  4. added
    Core
    and removed
    iOS
    on Aug 10, 2017
  5. kkaefer commented on Aug 10, 2017

    @kkaefer
    Member

    @ThiyagarajanShivSankaran it's hard to see this from the video; are you using raster tiles or vector tiles?

  6. ThiyagarajanShivSankaran commented on Aug 10, 2017

    @ThiyagarajanShivSankaran
    Author

    @kkaefer we are using vector tiles. Sorry for the video clarity can you download and check. Thanks.

  7. arnekaiser commented on Aug 10, 2017

    @arnekaiser
    Contributor

    This looks like #9211

    I think the expires timestamps in the database are expired after some days.

  8. andrewljohnson commented on Aug 17, 2017

    @andrewljohnson

    I think we fixed the bulk of this problem with a simple change, in src/mbgl/tile/tile_loader_impl.hpp

    template <typename T>
      void TileLoader<T>::loadedData(const Response& res) {
          if (res.error && res.error->reason != Response::Error::Reason::NotFound) {
     -        tile.setError(std::make_exception_ptr(std::runtime_error(res.error->message)));
     +        if (!(tile.isComplete() && tile.isRenderable())) {
     +          tile.setError(std::make_exception_ptr(std::runtime_error(res.error->message)));
     +        }
          } else if (res.notModified) {
              resource.priorExpires = res.expires;
              // Do not notify the tile; when we get this message, it already has the current
    
  9. ThiyagarajanShivSankaran commented on Aug 21, 2017

    @ThiyagarajanShivSankaran
    Author

    Can I know what is the status of this issue. We need this to be fixed immediately. Thanks.

  10. ThiyagarajanShivSankaran commented on Aug 29, 2017

    @ThiyagarajanShivSankaran
    Author

    @kkaefer @friedbunny @boundsj Status please ???

  11. friedbunny commented on Aug 30, 2017

    @friedbunny
    Contributor

    @ThiyagarajanShivSankaran There’s been no change in the status of this issue — when someone has the opportunity to investigate further, they will post an update here. In the meantime, any additional information (or testing of proposed fixes) is much appreciated.

  12. arethasamuel commented on Sep 1, 2017

    @arethasamuel

    @andrewljohnson is this fix in the latest release of mapbox sdk? 3.6.2? we will test this and get back to you

  13. andrewljohnson commented on Sep 1, 2017

    @andrewljohnson

    @arethasamuel not AFAIK

  14. arethasamuel commented on Sep 1, 2017

    @arethasamuel

    @andrewljohnson @kkaefer @friedbunny @boundsj

    this issue still exists in mapbox 3.6.2

    1. Turn on wifi --> Download all the offline packs.
    2. change the date time in device to tomorrow
    3. Open the device in airplane mode --> open the app again and the tiles are no longer showing

    So i opened up the cache.db sqlite database and found out that the table: tiles has a column called expires and the value of the expires column has a date 12 hours After the offline pack was installed.

    Is there a way to increase this time? (like at least by a year or something?)

  15. ThiyagarajanShivSankaran commented on Sep 5, 2017

    @ThiyagarajanShivSankaran
    Author

    Hi @friedbunny yeah the above fix is working.

  16. jmkiley commented on Sep 12, 2017

    @jmkiley
    Contributor

    @kkaefer do you think that the fix @andrewljohnson proposed in #9705 (comment) should be pulled into the SDK?

  17. kkaefer commented on Sep 13, 2017

    @kkaefer
    Member

    There are several underlying issues:

    • We're treating a 404 response/not found as a valid response meaning "there is no data here" instead of using a correct HTTP 204 No content response. E.g. here:
      } else if (responseCode == 204 || (responseCode == 404 && resource.kind == Resource::Kind::Tile)) {
    • When we have a tile successfully parsed/loaded (e.g. an expired tile from cache), subsequent attempts to refresh the tile fail, and overwrite the existing successfully parsed tile with empty data (this is what IOS: Offline pack is not working properly on next day when iPad is in offline. #9705 (comment) attempts to fix, although this fix doesn't work in situations where we're still parsing data (so the tile isn't renderable yet), then receive a revalidation error)

    I attempted a refactor of our tile state system in https://github.com/mapbox/mapbox-gl-native/tree/make-stale-resources-renderable, but it's incomplete.

  18. added this to the ios-v3.6.4 milestone on Sep 25, 2017
  19. friedbunny commented on Sep 25, 2017

    @friedbunny
    Contributor

    This should be fixed by #10012 and 3.6.4, which will be available imminently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Corebugoffline

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions