Cesium crash when zooming on the right border of a map

Context:
For the purpose of our project, we developed a custom map server that we tested on some GIS systems and we didn’t have any problems. The map server uses GDAL (gdal2tiles.py) to generate the tiles it serves.
We are trying to use our server with a Cesium app but we are facing some issues:

The Cesium widget is set with a custom blue-marble imageryProvider.

let defaultImageryProvider = new UrlTemplateImageryProvider({
                url: MAP_SERVER_URL + DEFAULT_WORLD_MAP + '/{z}/{x}/{y}',
                tilingScheme: new WebMercatorTilingScheme()
});
this.viewer = new Viewer(this.dom, {
                imageryProvider: defaultImageryProvider,
                baseLayerPicker: false,
                homeButton: false,
                timeline: false,
                geocoder: false,
                navigationHelpButton: false,
                fullscreenButton: false,
                sceneModePicker: false,
                animation: false
});

Other maps are added on user’s clicks via new imagery provider

let mapImageryProvider = new UrlTemplateImageryProvider({
                url: MAP_SERVER_URL + mapName + '/{z}/{x}/{y}',
                minimumLevel: mapZoomMin,
                maximumLevel: mapZoomMax,
                tilingScheme: new WebMercatorTilingScheme(),
                rectangle: mapRectangle
});
this.viewer.scene.imageryLayers.addImageryProvider(mapImageryProvider);

All imageryProvider are UrlTemplateImageryProvider with WebMercatorTilingScheme. The imageryProviders do their requests on our homemade map server.
The bug has been reproduced on Cesium v.1.81 & 1.83 with Chrome & Mozilla browser on Windows 10

Bug:
When the user zoom on the right border of some maps, cesium crashes.

Callstack:
An error occurred while rendering. Rendering has stopped.
TypeError: Cannot read property ‘west’ of undefined
TypeError: Cannot read property ‘west’ of undefined
at ImageryLayer._createTileImagerySkeletons (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2788646)
at prepareNewTile (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2771725)
at Function.GlobeSurfaceTile.initialize (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2775167)
at Function.GlobeSurfaceTile.processStateMachine (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2775307)
at GlobeSurfaceTileProvider.loadTile (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2823537)
at processSinglePriorityLoadQueue (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2879686)
at processTileLoadQueue (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2879294)
at QuadtreePrimitive.endFrame (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2869716)
at Globe.endFrame (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:2891354)
at render (http://127.0.0.1:8082/dep/cesium/Build/Cesium/Cesium.js:1:3292043)

@Arthur-R-A

Welcome to the community! Thank you very much for the detailed post. From what I can tell, this is a bug. However, without a sandcastle demo, I am unable to replicate this exact behavior on my machine.

I suggest submitting an issue on GitHub with the details that you outlined. Be sure to take the time to look through pre-existing issues for similar bugs.

If you have a solution, I recommend that you submit a pull request as well. I can coordinate with the rest of the Cesium development team to ensure that it is reviewed in a timely manner.

-Sam

Thank you for your response sam.rothstein

I apologise for answering so late. It seems the problem is on our side. I tried to replicate the issue in a way I can share with you. By doing so I found a way to solve my issue. I don’t know why but the cause of the issue was the rectangle option in the UrlTemplateImageryProvider that display the map. I removed it by accident and that solved my issue. Removing this option create other issue, but I’m confident that I can work around them.

Thanks
-Arthur

@Arthur-R-A

Thank you very much for following up and providing some more details on the issue.

We realized that the issue was on your side internally shortly after I added the issue on GitHub. Thus, we removed it from the Cesium GitHub page. However, it is good to have confirmation that we did the right thing:grinning:

-Sam