import21 / hyperkitty_import: sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one_or_none()
Hi all,
after upgrading from Mailman 2.1 to Mailman 3 (Debian Buster), one (but not all) of the lists causes the following exception. The list was imported using import21 and archives were imported using manage.py hyperkitty_import.
Jul 29 10:19:43 2019 (761) REST request handler error: Traceback (most recent call last): File "/usr/lib/python3.7/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/lib/python3/dist-packages/mailman/database/transaction.py", line 50, in wrapper rtn = function(*args, **kws) File "/usr/lib/python3/dist-packages/mailman/rest/wsgiapp.py", line 216, in __call__ return super().__call__(environ, start_response) File "falcon/api.py", line 215, in falcon.api.API.__call__ File "falcon/api.py", line 189, in falcon.api.API.__call__ File "/usr/lib/python3/dist-packages/mailman/rest/lists.py", line 402, in on_get archiver_set = IListArchiverSet(self._mlist) File "/usr/lib/python3/dist-packages/zope/interface/interface.py", line 135, in __call__ adapter = self.__adapt__(obj) File "/usr/lib/python3/dist-packages/zope/interface/interface.py", line 151, in __adapt__ adapter = hook(self, obj) File "/usr/lib/python3/dist-packages/zope/component/_api.py", line 156, in adapter_hook return sitemanager.queryAdapter(object, interface, name, default) File "/usr/lib/python3/dist-packages/zope/interface/registry.py", line 348, in queryAdapter return self.adapters.queryAdapter(object, interface, name, default) File "/usr/lib/python3/dist-packages/zope/interface/adapter.py", line 353, in queryAdapter return self.adapter_hook(provided, object, name, default) File "/usr/lib/python3/dist-packages/zope/interface/adapter.py", line 363, in adapter_hook result = factory(object) File "/usr/lib/python3/dist-packages/mailman/database/transaction.py", line 85, in wrapper return function(args[0], config.db.store, *args[1:], **kws) File "/usr/lib/python3/dist-packages/mailman/model/mailinglist.py", line 607, in __init__ ListArchiver.name == archiver_name).one_or_none() File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3017, in one_or_none "Multiple rows were found for one_or_none()" sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one_or_none()
I got that from the log file /var/log/mailman3/mailman.log. The Installation also sends emails to me, indicating some kind of exception in the except branch (see below).
What can I do to debug this?
Thanks,
Christian
Internal Server Error: /postorius/lists/LISTNAMEREDACTED/
KeyError at /postorius/lists/LISTNAMEREDACTED/ 'file'
Traceback:
File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in inner 41. response = get_response(request)
File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in _get_response 187. response = self.process_exception_by_middleware(e, request)
File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in _get_response 185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in view 68. return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/postorius/views/generic.py" in dispatch 65. return super(MailingListView, self).dispatch(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in dispatch 88. return handler(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/postorius/views/list.py" in get 252. 'hyperkitty' in self.mailing_list.archivers and # noqa: W504
File "/usr/lib/python3.7/_collections_abc.py" in __contains__ 666. self[key]
File "/usr/lib/python3/dist-packages/mailmanclient/restbase/base.py" in __getitem__ 151. return self._get(key)
File "/usr/lib/python3/dist-packages/mailmanclient/restbase/base.py" in _get 90. return self.rest_data[key]
File "/usr/lib/python3/dist-packages/mailmanclient/restbase/base.py" in rest_data 76. response, content = self._connection.call(self._url)
File "/usr/lib/python3/dist-packages/mailmanclient/restbase/connection.py" in call 99. raise HTTPError(url, response.status, content, response, None)
During handling of the above exception (HTTP Error 500: b'A server error occurred. Please contact the administrator.'), another exception occurred:
File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in inner 41. response = get_response(request)
File "/usr/lib/python3/dist-packages/postorius/middleware.py" in __call__ 39. return self.get_response(request)
File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in inner 43. response = response_for_exception(request, exc)
File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in response_for_exception 93. response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in handle_uncaught_exception 135. extra={'status_code': 500, 'request': request},
File "/usr/lib/python3.7/logging/__init__.py" in error 1412. self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python3.7/logging/__init__.py" in _log 1519. self.handle(record)
File "/usr/lib/python3.7/logging/__init__.py" in handle 1529. self.callHandlers(record)
File "/usr/lib/python3.7/logging/__init__.py" in callHandlers 1591. hdlr.handle(record)
File "/usr/lib/python3.7/logging/__init__.py" in handle 905. self.emit(record)
File "/usr/lib/python3/dist-packages/django/utils/log.py" in emit 118. reporter = ExceptionReporter(request, is_email=True, *exc_info)
File "/usr/lib/python3/dist-packages/django/views/debug.py" in __init__ 246. self.template_info = getattr(self.exc_value, 'template_debug', None)
File "/usr/lib/python3.7/tempfile.py" in __getattr__ 614. file = self.__dict__['file']
Exception Type: KeyError at /postorius/lists/LISTNAMEREDACTED/ Exception Value: 'file'
It was a constraint violation in the database (I guess caused by an importer). I fixed it manually. Is there a way to trigger all constraint checks from the mailman cli?
Thanks,
Christian
mailman3=# select id,list_name from mailinglist where list_name like 'LISTNAMEREDACTED'; id | list_name ----+------------- 22 | LISTNAMEREDACTED (1 row)
mailman3=# select * from listarchiver where mailing_list_id = 22; id | mailing_list_id | name | _is_enabled -----+-----------------+--------------+------------- 105 | 22 | mhonarc | f 106 | 22 | mail-archive | f 107 | 22 | prototype | f 108 | 22 | hyperkitty | t 109 | 22 | mhonarc | f (5 rows)
mailman3=# select * from listarchiver where mailing_list_id = 21; id | mailing_list_id | name | _is_enabled -----+-----------------+--------------+------------- 118 | 21 | mhonarc | f 119 | 21 | mail-archive | f 120 | 21 | prototype | f 121 | 21 | hyperkitty | t (4 rows)
mailman3=# select * from listarchiver where mailing_list_id = 22; id | mailing_list_id | name | _is_enabled -----+-----------------+--------------+------------- 105 | 22 | mhonarc | f 106 | 22 | mail-archive | f 107 | 22 | prototype | f 108 | 22 | hyperkitty | t 109 | 22 | mhonarc | f (5 rows)
mailman3=# delete from listarchiver where id = 109; DELETE 1
participants (1)
-
Christian Schwarz