fcache
fcache copied to clipboard
`'cs'` cache option is not thread safe
Hi,
I am using fcache version 0.4.7
I am getting the following error:
File "/root/app/collector/libs/eccache.py", line 15, in __init__
self.cache = FileCache(name, flag='cs', app_cache_dir=cache_dir)
File "/usr/local/lib/python2.7/site-packages/fcache/cache.py", line 121, in __init__
self.create()
File "/usr/local/lib/python2.7/site-packages/fcache/cache.py", line 141, in create
os.makedirs(self.cache_dir)
File "/usr/local/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
Hello! Can you try manually checking if Python sees the directory as already existing?
>>> import os
>>> cache_dir = '/my/cache/dir'
>>> os.path.exists(cache_dir)
If it returns False, but the directory really does exist, it’s likely a permission issue.
Hi,
The operation is not thread-safe. When i use more than one thread, i get this error.
@arindamchoudhury Oh okay, that makes sense! I'll label this as a bug in case anyone sees it and wants to submit a pull request to fix it.
I got some kind of solution here, but it is entirely for multiprocess: https://github.com/tsroten/fcache/issues/26
May be you find it useful.