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

Tiles not drawn when other tiles have CORS errors #12024

Closed
fr-an-k opened this issue Jun 21, 2022 · 5 comments
Closed

Tiles not drawn when other tiles have CORS errors #12024

fr-an-k opened this issue Jun 21, 2022 · 5 comments

Comments

@fr-an-k
Copy link

fr-an-k commented Jun 21, 2022

mapbox-gl-js version:
All 2.x versions up to 2.9.0

browser:
Chrome Version 102.0.5005.115 (Official Build) (64-bit)

Steps to Trigger Behavior

Happens regularly in vector tile sources.

Screenshot

mapbox_issue

Expected Behavior

Show my tiles

Actual Behavior

Tiles disappear when moving left beyond a certain x coordinate.

@stepankuzmin
Copy link
Contributor

Hi @fr-an-k,

Could you please provide more details about your environment (OS), whether this happens in all browsers or just one, are there any warnings in the console, etc.?

@fr-an-k
Copy link
Author

fr-an-k commented Jun 21, 2022

Same happens in Firefox and Edge except in these instance the tiles appear when going to the left; I suspect a shader issue.

Windows 11 Pro 21H2, build 22000.739
Intel i7, 32GB RAM
Intel UHD graphics 630
NVIDIA Quadro P600 (probably not used for the browser)

@fr-an-k
Copy link
Author

fr-an-k commented Jun 21, 2022

Oh wait I do get errors; some tiles don't exist in the panned-to area, and as a consequence return HTTP status code 403 (forbidden). This probably interrupts the rest of the tile display proces somehow. Sorry about that, I'll have to investigate this further myself.

@fr-an-k fr-an-k changed the title Tiles disappearing/reappearing when panning Tiles disappearing/reappearing when other tiles return HTTP code 403 (forbidden) Jun 21, 2022
@fr-an-k
Copy link
Author

fr-an-k commented Jun 21, 2022

It was a CORS issue (fetch exception, probably of another tile) that probably blocked an internal tile callback of a visible tile.
Technically it's an issue in Mapbox, but you can close this case if you don't support CORS error handling (tiles that don't exist).

I solved it with a hack ( custom source type, overriding some internal Mapbox class); unfortunately it's still not 100%, I suspect a cancelled tile is being cached as a missing tile and therefore not reloaded when visiting the area again. Probably due to my limited knowledge of the Mapbox internals.

Ideally Mapbox would decouple HTTP from the tile mapping system and allow a custom tile blob loader. The use case for this would be offline(-first) functionality, custom fetching (handle CORS errors), and client-side image processing, without resorting to a hack or service worker (which does not implement the cancel signal and therefore causes onworkable map stuttering).

@fr-an-k fr-an-k changed the title Tiles disappearing/reappearing when other tiles return HTTP code 403 (forbidden) Tiles disappearing/reappearing when other tiles have CORS errors Jun 21, 2022
@fr-an-k fr-an-k changed the title Tiles disappearing/reappearing when other tiles have CORS errors Tiles not drawn when other tiles have CORS errors Jun 21, 2022
@stepankuzmin
Copy link
Contributor

Thanks for the feedback, @fr-an-k

We have an experimental Custom Source API that decouples data fetching from the tiling. You can try this example https://github.com/mapbox/mapbox-gl-js/blob/80e5afd1babdac879cc63dfd2abab4c3bc760837/debug/custom-source.html.

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

No branches or pull requests

2 participants