Skip to content
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

'cs' cache option is not thread safe #25

Open
arindamchoudhury opened this issue Jul 19, 2018 · 4 comments
Open

'cs' cache option is not thread safe #25

arindamchoudhury opened this issue Jul 19, 2018 · 4 comments
Labels

Comments

@arindamchoudhury
Copy link

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)

@arindamchoudhury arindamchoudhury changed the title Cache File exists even using flag='cs' Cache File exists error even using flag='cs' Jul 19, 2018
@tsroten
Copy link
Owner

tsroten commented Jul 19, 2018

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.

@arindamchoudhury
Copy link
Author

Hi,

The operation is not thread-safe. When i use more than one thread, i get this error.

@tsroten
Copy link
Owner

tsroten commented Jul 23, 2018

@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.

@tsroten tsroten added the bug label Jul 23, 2018
@tsroten tsroten changed the title Cache File exists error even using flag='cs' 'cs' cache option is not thread safe Jul 23, 2018
@andry81
Copy link

andry81 commented Nov 9, 2019

I got some kind of solution here, but it is entirely for multiprocess: #26

May be you find it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants