This object is in archive! 
Tile cache polluted with garbage data in connection with Osmapa.pl faults
Solved
Recently, the Osmapa.pl tile server is facing issues again, some zoom levels are not loading at all. Okay, I've already got used to that it is quite unstable, but I found Locus doing a nasty thing about it. In the case of tiles that could not be downloaded, it clutters the tile cache with garbage data (1 byte image blobs), which means that until the expiry of these garbage entries, it will not retry to download these tiles next time. What's worse, if the cache already contains downloaded correctly tile in the past, and when Locus tries to refresh it and fails, it overwrites it with a garbage entry. Is this how it should work?
As a workaround, I added two triggers to the cache database that block putting garbage into the table. It's much better now! In case of garbage update, it sets timestamp of previously cached tile to 9 months back from now to check again in a 3 months, as my tile cache expiration is set to 1 year.
CREATE TRIGGER a1 before update of image ON tiles when length (new.image)<2 BEGIN update tiles set s=new.s-24*30*9 where x=new.x and y=new.y and z=new.z; select raise(fail, 'x');END
CREATE TRIGGER a2 before insert ON tiles when length (new.image)<2 BEGIN select raise(fail, 'x');END
As a workaround, I added two triggers to the cache database that block putting garbage into the table. It's much better now! In case of garbage update, it sets timestamp of previously cached tile to 9 months back from now to check again in a 3 months, as my tile cache expiration is set to 1 year.
CREATE TRIGGER a1 before update of image ON tiles when length (new.image)<2 BEGIN update tiles set s=new.s-24*30*9 where x=new.x and y=new.y and z=new.z; select raise(fail, 'x');END
CREATE TRIGGER a2 before insert ON tiles when length (new.image)<2 BEGIN select raise(fail, 'x');END
Hello Maciej,
I'm checking these maps and here are my observations. I would not call 1-byte images as "garbage". Server in some cases returns 404 error, which means "Not found". Why should the server return something like this? It's usually because the requested tile does not exist! Because of this, Locus insert this small empty image instead of tile, to prevent calling on the same tile, that does not exist, again. This is valid behavior and works correctly for all other services (where 404 is usually returned when the app asks for tiles our of map coverage).
Fact that this map has such problem for a longer time, leads more to contact it's owners or rather remove it.
@Petr Voldan may it worth contacting owners? Do we have any direct contact here?
Hello Maciej,
I'm checking these maps and here are my observations. I would not call 1-byte images as "garbage". Server in some cases returns 404 error, which means "Not found". Why should the server return something like this? It's usually because the requested tile does not exist! Because of this, Locus insert this small empty image instead of tile, to prevent calling on the same tile, that does not exist, again. This is valid behavior and works correctly for all other services (where 404 is usually returned when the app asks for tiles our of map coverage).
Fact that this map has such problem for a longer time, leads more to contact it's owners or rather remove it.
@Petr Voldan may it worth contacting owners? Do we have any direct contact here?
Hi,
I contacted the osmapa.pl admins to obtain more info about the issue. I can see from our previous communication that there were some troubles with HDD on their server. Maybe it's again some temporary issue.
BR Petr
Hi,
I contacted the osmapa.pl admins to obtain more info about the issue. I can see from our previous communication that there were some troubles with HDD on their server. Maybe it's again some temporary issue.
BR Petr
Great, thanks for the intervention! Menion, technically you probably are right, but it is as it is. The server is unstable, but the map is irreplaceable so far and it would be a big pity to remove it, despite the fact that the project is not very active, and the map looks clumsy. At least I learned something about how tile cache works, and now having an efficient workaround in case of future server problems. :)
Great, thanks for the intervention! Menion, technically you probably are right, but it is as it is. The server is unstable, but the map is irreplaceable so far and it would be a big pity to remove it, despite the fact that the project is not very active, and the map looks clumsy. At least I learned something about how tile cache works, and now having an efficient workaround in case of future server problems. :)
Replies have been locked on this page!