[MapProxy] readonly mbtiles errors

Paul Norman penorman at mac.com
Sat May 12 00:55:09 EDT 2012


I have been encountering some errors when using mapproxy to turn a slow
remote WMS server to a faster locally hosted TMS server

The error is: OperationalError: attempt to write a readonly database. 

I do not encounter this error when using mapproxy-util to test, only in
production. This holds true when running mapproxy-util as www-data. The
error does not occur 100% of the time, only on some requests. I have set the
mode of the cache directory and .mbtiles files to 777. I have also tried
concurrent_requests: 1. 

The full error from my apache logs (stripped of IP and timestamp information
for space) is as follows

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/wsgiapp.py", line
159, in __call__
    resp = self.handlers[handler_name].handle(req)
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/service/base.py",
line 30, in handle
    return handler(parsed_req)
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/service/tile.py",
line 68, in map
    tile = layer.render(tile_request,
use_profiles=tile_request.use_profiles)
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/service/tile.py",
line 208, in render
    tile = self.tile_manager.load_tile_coord(tile_coord, with_metadata=True)
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/cache/tile.py", line
105, in load_tile_coord
    created_tiles = creator.create_tiles([tile])
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/cache/tile.py", line
227, in create_tiles
    created_tiles = self._create_meta_tiles(meta_tiles)
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/cache/tile.py", line
297, in _create_meta_tiles
    created_tiles.extend(self._create_meta_tile(meta_tile))
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/cache/tile.py", line
311, in _create_meta_tile
    self.cache.store_tiles(splitted_tiles)
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/cache/base.py", line
60, in store_tiles
    if not self.store_tile(tile):
  File "/usr/local/lib/python2.7/dist-packages/mapproxy/cache/mbtiles.py",
line 107, in store_tile
    cursor.execute(stmt, (level, x, y, buffer(content)))
OperationalError: attempt to write a readonly database


I welcome any thoughts on how I could fix this.



More information about the MapProxy mailing list