New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shape plugin keeps stale references to deleted files #784
Comments
[albertov] I forgot to add that the Map, Datasource and every related instances are freshly created for every render by my app, they are not reused (which might have explained this behavior). |
[albertov] Configuring mapnik with {{{SHAPE_MEMORY_MAPPED_FILE=False}}} fixes (or works-around?) the issue. Perhaps the code-paths taken when setting this setting should take into account if the file's inode has changed? or perhaps make this a runtime configuration option instead of a compile-time option for shapefiles which are expected to be replaced? |
[artem] We need to check if mapping region is still valid when returning cached pointer. Couple ways to fix it, thanks for reporting this! |
[albertov] Can I help with closing this before 2.0.1? If no definite solution can be found perhaps {{{SHAPE_MEMORY_MAPPED_FILE}}} can be set to False by default before the release so packagers don't end up distributing versions with this bug. Alberto |
[springmeyer] I've assumed that memory mapping being default on is pretty critical for performance, but have never actually tested. alberto, is this something you could do? See how much of a benefit the mapping gives for indexed shapefiles? If it does not have a big benefit then I might feel different about disabling this by default. Either way I figure it would be nice to have it as a runtime option eventually. |
[springmeyer] see also https://github.com/mapbox/tilemill/issues/714 which may be related to the mapped regions being invalid - not sure... |
[springmeyer] alberto - also note that the issue may not be the memory mapping but that we cache the mapped regions. it would likely be pretty easy to add an option to the shapefile driver to be able to still use memory mapping, but just not to cache the regions. |
[artem] Moving to 2.0.1 |
moving to 2.1 |
sorry to be here. I just try to use clear_cache() in python to apply some tiny modify in shapefile. however it seems not working. Is it already a function in python? I'm using version 3.0.20 |
Mapnik (trunk) seems to keep shapefiles open once it finishes with them which causes stale data to be rendered if the file is deleted and replaced with another one with the same name in the meantime. lsof confirms it:
If apache is restarted then the correct shapefile is rendered. This regression was introduced somewhen after r2344 but I can't find the exact revision. Any clues?
The text was updated successfully, but these errors were encountered: