On 09/06/2018 10:16 AM, Dmitry Makovey wrote:
I'm tracing slowness of mailman in our infrastructure, and came across ORM exception:
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2837, in one ret = self.one_or_none() File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2816, in one_or_none "Multiple rows were found for one_or_none()") sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one_or_none()
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python3.6/site-packages/mailman/database/transaction.py", line 50, in wrapper rtn = function(*args, **kws) File "/usr/local/lib/python3.6/site-packages/mailman/rest/wsgiapp.py", line 214, in __call__ return super().__call__(environ, start_response) File "/usr/local/lib/python3.6/site-packages/falcon/api.py", line 244, in __call__ responder(req, resp, **params) File "/usr/local/lib/python3.6/site-packages/mailman/rest/members.py", line 365, in on_post return self._find(request, response) File "/usr/local/lib/python3.6/site-packages/mailman/rest/members.py", line 389, in _find okay(response, etag(resource._make_collection(request))) File "/usr/local/lib/python3.6/site-packages/mailman/rest/helpers.py", line 159, in _make_collection for resource in collection] File "/usr/local/lib/python3.6/site-packages/mailman/rest/helpers.py", line 159, in <listcomp> for resource in collection] File "/usr/local/lib/python3.6/site-packages/mailman/rest/members.py", line 72, in _resource_as_dict user = member.user File "/usr/local/lib/python3.6/site-packages/mailman/model/member.py", line 128, in user else getUtility(IUserManager).get_user(self._address.email)) File "/usr/local/lib/python3.6/site-packages/mailman/database/transaction.py", line 85, in wrapper return function(args[0], config.db.store, *args[1:], **kws) File "/usr/local/lib/python3.6/site-packages/mailman/model/usermanager.py", line 88, in get_user return addresses.one().user File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2840, in one "Multiple rows were found for one()") sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one()
is this a known thing and what's the best path for fixing it?
I think we're being spammed from 'qq.com' network:
mailmandb=# select count(*) from address where user_id is NULL and email like '%qq.com'; count
44225 (1 row)
how safe is it to execute something like:
delete from address where user_id is NULL and email like '%qq.com';
?? I'm hoping to get rid of above exception
-- Sr System and DevOps Engineer SoM IRT