tileserver-php icon indicating copy to clipboard operation
tileserver-php copied to clipboard

Data bleeds between multiple instances of tileserver.php on same server when same tileset name is used

Open bjnsn opened this issue 7 years ago • 0 comments

This is the scenario I encountered:

You have two directories A and B each containing the default tileserver.php and a tileset tiles.mbtiles. A/tiles.mbtiles contains different data than B/tiles.mbtiles.

If you request A/tileserver.php?/tiles/7/8/9.pbf and then request B/tileserver.php?/tiles/6/7/8.pbf this second request will sometimes receive data from A/tiles.mbtiles rather than B/tiles.mbtiles.

This appears to be due to persistence within this line from DBConnect that is maintained without regard the tileset's full path: $this->db = new PDO('sqlite:' . $tileset, '', '', array(PDO::ATTR_PERSISTENT => true));

Changing the dataRoot configuration so that the full path for tiles.mbtiles is passed to DBConnect fixes the issue. I would suggest switching the default configuration from $config['dataRoot'] = ''; to $config['dataRoot'] = __DIR__;.

This fixes the issue in my tests on: Ubuntu + Nginx + PHP7.0-FPM Ubutnu + Apache + PHP OSX + PHP

bjnsn avatar Jun 13 '18 19:06 bjnsn