[4.1.3] Task mayan.apps.sources.tasks.task_source_process_document raises unexpected LockError
After upgrading from 4.1 to 4.1.3, I get an unexpected LockError in the logs every now and again when a watch folder source is checked.
(Please see sample log output below.)
Seems to be related to 2da952e7.
I can reproduce on a fresh install of 4.1.3 with docker-compose in a virtual machine. I was simulating my own 'live' installation, so I did the following:
- Install Mayan EDMS
- Create 7 watch folders, each watching a different folder (/tmp/test-source-1 ... /tmp/test-source-7), with a check interval of 15 seconds
- Watch the logs, and - it appears to be randomly, but may not be - the LockError is thrown every so often.
I wouldn't normally use such a short check interval, but that is/was a poor workaround for #1064.
[2021-11-18 22:24:04,138: ERROR/ForkPoolWorker-4] Task mayan.apps.sources.tasks.task_source_process_document[b24329e9-2a75-4e9e-ad45-5cecb6497447] raised unexpected: LockError()
Traceback (most recent call last):
File "/opt/mayan-edms/lib/python3.7/site-packages/celery/app/trace.py", line 450, in trace_task
R = retval = fun(*args, **kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/celery/app/trace.py", line 731, in __protected_call__
return self.run(*args, **kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/sources/tasks.py", line 53, in task_source_process_document
source.error_log.all().delete()
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/logging/classes.py", line 70, in method_instance_logs
error_log_partition, created = error_log_instance.model.partitions.get_or_create(
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/logging/classes.py", line 44, in model
lock = LockingBackend.get_backend().acquire_lock(lock_id)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/lock_manager/backends/base.py", line 32, in acquire_lock
return cls._acquire_lock(name=name, timeout=timeout)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/lock_manager/backends/redis_lock.py", line 20, in _acquire_lock
return RedisLock(name=name, timeout=timeout)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/lock_manager/backends/base.py", line 48, in __init__
return self._init(*args, **kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/lock_manager/backends/redis_lock.py", line 73, in _init
raise LockError
mayan.apps.lock_manager.exceptions.LockError