I interrupt my script often during development. This almost always leads to cache being locked and corrupted. I then have to remove both the lock and the cache itself. > WARNING Found lock /home/zelialx/.cache/nitrate.lock, opening read-only > ERROR Failed to load the cache (CRC check failed 0x7274696e != 0x0L) > ERROR Cache file: /home/zelialx/.cache/nitrate > WARNING Going on but switching to CACHE_OBJECTS level I suggest * breaking the lock if the PID from the lockfile is no longer running. There's no point in keeping the cache locked for an already finished process. * writing the cache into a temporary file and only once the write is successfully finished, renaming this file to the official cache filename. This way the cache should never get corrupted when the script is interrupted mid-dump.
Created attachment 890809 [details] patch for the lock breaking
Created attachment 890842 [details] atomic cache write patch
Thanks for the idea and patches, Aleš! These should definitely make the persistent caching more reliable. I've committed a slightly modified version of your patch for breaking stale locks: https://github.com/psss/python-nitrate/commit/2874c9ce50f03c3a33b Applied your patch for limiting the cache writing window: https://github.com/psss/python-nitrate/commit/da2a9ac17adc96e9aae And finally did some cleanup and moved the locking/unlocking code into separate methods and enhanced the cache load error detection to gracefully handle corrupted cache files as well: https://github.com/psss/python-nitrate/commit/bef96f3dba50088d195 Now when the cache is corrupted an error is displayed and the cache level is switched to CACHE_OBJECTS instead of bailing out.
*** Bug 1094105 has been marked as a duplicate of this bug. ***
python-nitrate-1.3-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-687d19409b
python-nitrate-1.3-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-2bb9364c32
python-nitrate-1.3-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-7474e957a9
python-nitrate-1.3-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-35a106d076
python-nitrate-1.3-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
python-nitrate-1.3-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
python-nitrate-1.3-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.
python-nitrate-1.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.