"Rebuild indexes" does not work in Mayan EDMS 2.3
How to reproduce?
docker run -d --name mayan-edms --restart=always -p 80:80 -v mayan_data:/var/lib/mayan mayanedms/mayanedms:2.3
- Go to http://127.0.0.1/
- Log in
- Upload two documents (creation date seconds must be different!)
- Change the "Creation date" index template to look like this:
Root ➥ {{ document.date_added|date:"s" }} ➥ {{ document.date_added|date:"Y" }}
- Try to rebuild this index
It does not work and results in one of the following errors (I have different indexes in my instances and the error varies):
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
42. response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/common/mixins.py" in dispatch
319. ).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/common/mixins.py" in dispatch
284. ).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in post
183. return self.form_valid(form)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/views.py" in form_valid
326. task_rebuild_index(index_id=index.pk)
File "/usr/local/lib/python2.7/dist-packages/celery/local.py" in __call__
188. return self._get_current_object()(*a, **kw)
File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py" in __call__
428. return self.run(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/tasks.py" in task_rebuild_index
89. index.rebuild()
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in rebuild
114. self.index_document(document=document)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
90. self.template_root.index_document(document=document)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
214. child.index_document(document=document, acquire_lock=False)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
255. child.index_document(document=document, acquire_lock=False)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
248. parent=self.parent.index_instance_nodes.get(),
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in manager_method
85. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in get
389. (self.model._meta.object_name, num)
Exception Type: MultipleObjectsReturned at /indexing/rebuild/all/
Exception Value: get() returned more than one IndexInstanceNode -- it returned 2!
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
42. response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/common/mixins.py" in dispatch
319. ).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/common/mixins.py" in dispatch
284. ).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in post
183. return self.form_valid(form)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/views.py" in form_valid
326. task_rebuild_index(index_id=index.pk)
File "/usr/local/lib/python2.7/dist-packages/celery/local.py" in __call__
188. return self._get_current_object()(*a, **kw)
File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py" in __call__
428. return self.run(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/tasks.py" in task_rebuild_index
89. index.rebuild()
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in rebuild
114. self.index_document(document=document)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
90. self.template_root.index_document(document=document)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
214. child.index_document(document=document, acquire_lock=False)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
255. child.index_document(document=document, acquire_lock=False)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
248. parent=self.parent.index_instance_nodes.get(),
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in manager_method
85. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in get
385. self.model._meta.object_name
Exception Type: DoesNotExist at /indexing/rebuild/all/
Exception Value: IndexInstanceNode matching query does not exist.
Afterwards the index contains only one document - the most recent one.
Also any subsequent attempt to reindex again fails because the locks were not released properly:
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
42. response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/common/mixins.py" in dispatch
319. ).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/common/mixins.py" in dispatch
284. ).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in post
183. return self.form_valid(form)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/views.py" in form_valid
326. task_rebuild_index(index_id=index.pk)
File "/usr/local/lib/python2.7/dist-packages/celery/local.py" in __call__
188. return self._get_current_object()(*a, **kw)
File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py" in __call__
428. return self.run(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/tasks.py" in task_rebuild_index
92. raise self.retry(exc=exception)
File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py" in retry
668. maybe_reraise() # raise orig stack if PyErr_Occurred
File "/usr/local/lib/python2.7/dist-packages/celery/utils/__init__.py" in maybe_reraise
248. reraise(exc_info[0], exc_info[1], exc_info[2])
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/tasks.py" in task_rebuild_index
89. index.rebuild()
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in rebuild
114. self.index_document(document=document)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
90. self.template_root.index_document(document=document)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/document_indexing/models.py" in index_document
189. 'indexing:indexing_template_node_{}'.format(self.pk)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/lock_manager/backends/file_lock.py" in acquire_lock
31. instance = FileLock(name=name, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/mayan/apps/lock_manager/backends/file_lock.py" in __init__
71. raise LockError
Exception Type: LockError at /indexing/rebuild/all/
Exception Value: