Tiles missing at certain zoom level for certain areas

Hi all

I have posted this question on OSM Help Forum but did not get any ideas on this. So I post it here to see if guys here can help me. Thanks in advance.

I have setup an osm tile server (following switch2osm) and wrote a simple javascript to browse the content (I have tried both OpenLayers and Leaflet but both have the same problem, so I guess it must be something wrong with my rendering). The problem is for certain parts on the map when I zoomed into certain levels, the tiles were just missing and the missing areas were simply blank squares (more strangely some blank tiles got partially rendered. Please have good at my screen shot.). I have checked the tiles that are missing are always for the same areas at the same zoom level.

I downloaded the osm data from bbbike.org. Recently I have observed another strange thing is that I setup two layers in leaflet (both layers are rendered from the same data base with same data). When I switch between the two layers, the missing tiles are oddly different for the two layers.

Any idea on how this happens and what I should do to fix it? Thanks. I have attached screenshots and also uploaded a Youtube video https://youtu.be/vkp3JTbPepo that can visually show the problem. Thanks.

Are all your tiles pre-rendered?

Or are they rendered on-the-fly / on demand depending on where you browse the map?

Do you have any errors in your browser error console?

Are there any log files from your rendering queue or your tileserver?

What about testing another source for raw OSM data?

Sod’s law, of course, but after asking this question here a couple of (partial) answers have popped up on the help site: