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

recursive tile loading for 404s doesn't work for dem tiles #11161

Open
ansis opened this issue Oct 21, 2021 · 2 comments · Fixed by #11276
Open

recursive tile loading for 404s doesn't work for dem tiles #11161

ansis opened this issue Oct 21, 2021 · 2 comments · Fixed by #11276

Comments

@ansis
Copy link
Contributor

ansis commented Oct 21, 2021

If the terrain dem tileset is sparse (tiles don't go up to the full maxzoom in all areas), terrain tiles can fail to load. Terrain only loads after a bunch of panning or zooming. Discovered through #11153

mapbox-gl-js version: main

browser: all

Steps to Trigger Behavior

  1. add a sparse dem tile source
  2. load the map in an area where the tiles don't go up to the max zoom level with a zoom greater than the max zoom that returns tiles.

Link to Demonstration

// internal

Expected Behavior

Terrain loads.

Actual Behavior

Terrain only loads after a bunch of panning.


If a tile 404s, we call sourceCache.update(...) to continue looking for a parent tile:

if ((err: any).status !== 404) this._source.fire(new ErrorEvent(err, {tile}));
// continue to try loading parent/children tiles if a tile doesn't exist (404)
else this.update(this.transform);

But we skip the update for terrain tiles (as an optimization, not intended for this situtation):

if (this.usedForTerrain && !updateForTerrain) {
// If source is used for both terrain and hillshade, don't update it twice.
return;
}

If we pass the right flag to update(...), tiles will load successfully.

If we want to rely on recursive tile loading we need to review it carefully and add more tests. I don't think we've relied on this before, so I'm not confident there aren't other bugs.

@SnailBones
Copy link
Contributor

SnailBones commented Feb 28, 2022

This issue seems to to be persisting in some cases. From #11153 (comment):

Here's a minimal project to reproduce the issue: https://github.com/JuanIrache/mapbox-404 (npm install and npm start to run it).

Setting the zoom and center to non-existing tiles once does not cause it, but doing it again after a couple of seconds does. The minimal project does not seem to fail 100% of the times, but in my test most do (the "idle" message is not printed to the console after the second center change).

To me it looks like the same issue, just less frequent, but let me know if you think I should open a new one.

cc @JuanIrache @stepankuzmin

@stepankuzmin
Copy link
Contributor

Thanks for the heads up @SnailBones

I can confirm that the issue persists in the provided example. It seems that the map is in a loaded state even if we re-request parent tiles for missing children.

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

Successfully merging a pull request may close this issue.

3 participants