possible Threading issue
Hi, we are using Mailman Core without Postorius/Hyperkitty and manage Subscriptions via REST API. Recently we see newsletter getting shunted because of an error:
Mar 11 10:49:36 2020 (7197) Uncaught runner exception: 'NoneType' object has no attribute 'delivery_mode'
Mar 11 10:49:36 2020 (7197) Traceback (most recent call last):
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/core/runner.py", line 173, in _one_iteration
self._process_one_file(msg, msgdata)
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/core/runner.py", line 266, in _process_one_file
keepqueued = self._dispose(mlist, msg, msgdata)
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/runners/pipeline.py", line 37, in _dispose
process(mlist, msg, msgdata, pipeline)
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/core/pipelines.py", line 50, in process
handler.process(mlist, msg, msgdata)
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/handlers/member_recipients.py", line 84, in process
for member in mlist.regular_members.members
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/handlers/member_recipients.py", line 83, in <genexpr>
recipients = set(member.address.email
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/model/roster.py", line 239, in members
yield from self._get_members(DeliveryMode.regular)
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/model/roster.py", line 226, in _get_members
if member.delivery_mode in delivery_modes:
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/model/member.py", line 191, in delivery_mode
return self._lookup('delivery_mode')
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/model/member.py", line 150, in _lookup
pref = getattr(self.preferences, preference)
AttributeError: 'NoneType' object has no attribute 'delivery_mode'
Mar 11 10:49:36 2020 (7197) SHUNTING: 1583920176.5792215+7c7b058fef3433fa95cf2a73be7249ba27b93b59
In the logfile we see that members unsubscribed from this list while it is processed. Because of GDPR we delete users via API if they do not have any subscriptions left after unsubscribing.
What could be done to prevent this error?
We patched member.py to call getattr
with a default value of None
but this just caused another problem:
...
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/model/member.py", line 153, in _lookup
pref = getattr(self.address.preferences, preference, None)
File "/usr/local/mailman/lib/python3.5/site-packages/mailman/model/member.py", line 103, in address
if self._address is None
AttributeError: 'NoneType' object has no attribute 'preferred_address'
Mailman version is 3.3.0
Kind Regards