makelock error: "Permission denied" when reindexing from the web admin page
When I try to update the whoosh index from the admin page, I get a 500 Internal Server Error and the following backtrace in the server logfile:
File '/usr/lib/python2.7/dist-packages/rhodecode/lib/pidlock.py', line 131 in makelock pidfile = open(self.pidfile, "wb") IOError: [Errno 13] Permission denied: '/etc/task_42c2da77081ac972d025ef0d346bf430.lock'
This is because my configuration file is /etc/rhodecode.ini and rhodecode is not run as root.
I finally found a workaround. I don't know if it is the right way to fix this so I'm not making a pull request. Instead, I give the patch that I applied to have it work on my config:
--- rhodecode/lib/celerylib/__init__.py 2012-11-30 17:44:11.000000000 +0100 +++ rhodecode/lib/celerylib/__init__.py 2012-11-30 18:35:49.000000000 +0100 @@ -93,7 +93,7 @@ def locked_task(func): def __wrapper(func, *fargs, **fkwargs): lockkey = __get_lockkey(func, *fargs, **fkwargs) - lockkey_path = config['here'] + lockkey_path = config['app_conf']['cache_dir'] log.info('running task with lockkey %s' % lockkey) try:
I decided to use the cache_dir configuration variable because I'm sure that rhodecode will have write access to this directory.