Canceled vector tile requests show "failed to fetch" information in the console
Hello there!
I have a vector tile server (https, on Azure) that serves vector tiles data (application/x-protobuf) to the frontend, and the frontend is using mapbox-gl-js and angular.
In Google Chrome, the connection would fail occasionally with the error as "Err_connection_closed". It normally fires when there are zoom level changes with other canceled tile fetches. The annoying part is that it leaves hundreds of ambiguous "failed to fetch" error in the console.
The failed connections if I call again specifically, will all return 200 or 204 normal responses. That's why I believe it is not a real failure from the server, but something in the middle is playing up.
Other interesting bits:
- It seems not happening with the same server but http endpoint
- It seems the error in the console mostly happens in Firefox and Chrome but not Safari on MacOS
- It happens on localhost and remote
- It happens in mapbox-gl-js version 1, 2, and 3
While I can't guarantee this must be a mapbox issue, it would be helpful to point out something we could test out from the mapbox side.
mapbox-gl-js version: 3.2, 2.5, 1.13 (multiple versions)
browser: Google Chrome, Firefox
Steps to Trigger Behavior
- Start with a mapbox basemap and a the vector tile layer (e.g. points). The map is set at low zoom level (5.5).
- Click on one of the features (i.e. a point), and the map will zoom to that location by calling
map.flyTo({center: coords, zoom: 16}) - When the map is flying to that particular location, there are a lot of cancelled tile requests from the zoom levels in between. While these are normal and handled by internally, some of the requests, which I believe should also be canceled requests, are shown as
(failed) net::ERR_CONNECTION_CLOSED. (see the screenshot above) If these endpoints are called specifically for a second time, they all return success responses (either 200 or 204).
Link to Demonstration
Sorry it is not a public application, but happy to provide further information.
Expected Behavior
The cancelled tile requests should not log fetch error in the console.
Actual Behavior
Significant number of fetch errors in the console.
Thank you!
204 means empty response right? But it's zero bytes so there is no data. I think you should check the mbtile source. Maybe with a different tool.
No it is not about 204 responses. 204 is happening when there's no data at (x,y) @ zoom level (z), and it is normal behaviour.
What I'm saying is that when the canceled vector tile requests are fired (which is normal for Mapbox flyTo event), I got failed requests at the same time.
It seems some of the canceled requests become "failed" and haven't been handled nicely by Mapbox.