makelock error: "Permission denied" when reindexing from the web admin page

Issue #666 resolved
pitchum created an issue

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/', 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/     2012-11-30 17:44:11.000000000 +0100
+++ rhodecode/lib/celerylib/     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']
'running task with lockkey %s' % lockkey)

I decided to use the cache_dir configuration variable because I'm sure that rhodecode will have write access to this directory.

Comments (3)

  1. Marcin Kuzminski repo owner

    That makes totally sense. RhodeCode will always have write access to cache_dir, while as in your example not always to the where config is located. I'll apply this patch to beta branch, or you can send me a pull request. Thanks !

  2. pitchum reporter

    I don't think that a fork/commit/pull request is really needed for this. Applying the patch is the simplest solution.

  3. Log in to comment