siibra cache is not thread-safe #489
Labels
bug
Something isn't working
caching&persistence
Issues related to storing siibra objects - caching persistence and serialization.
I just encountered an error while running parallel siibra calls from many different processes (through snakemake):
The same error occurred for multiple parallel processes at the same time. This makes me assume that the file-based cache that siibra uses internally is probably not thread-safe. I had a quick look at the code of the cache, in particular the
run_maintenance
function. This function seems to delete some previously identified files from the cache. However, there is no check to handle the case where another process deletes a file after it was found in the folder. As I see it, this is indeed not safe to use from multiple processes/threads.Checking whether a file still exists before deleting it, or putting a lock around cache modifications in general could solve this issue (although the latter probably would have some performance implications).
The text was updated successfully, but these errors were encountered: