Kallithea issues archive

Issue #363: Error in send_mail after upgrade to celery 4.4

Reported by: vyom
State: resolved
Created on: 2020-02-26 00:55
Updated on: 2020-03-01 00:50

Description

After upgrading Kallithea to latest version has send_mail error.

Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,598: INFO/MainProcess] Received task: kallithea.lib.celerylib.send_email[25db2e2e-1a84-40bf-9561-cc7818f60ee4]
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,599: DEBUG/MainProcess] TaskPool: Apply <function _fast_trace_task at 0x7f42bc2ad048> (args:('kallithea.lib.celerylib.send_email', '25db2e2e-1a84-40bf-9561-cc7818f60
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,600: DEBUG/MainProcess] Task accepted: kallithea.lib.celerylib.send_email[25db2e2e-1a84-40bf-9561-cc7818f60ee4] pid:22129
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,728: ERROR/ForkPoolWorker-2] Task kallithea.lib.celerylib.send_email[25db2e2e-1a84-40bf-9561-cc7818f60ee4] raised unexpected: AttributeError("'dict' object has no at
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: Traceback (most recent call last):
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/celery/app/trace.py", line 385, in trace_task
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     R = retval = fun(*args, **kwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/celery/app/trace.py", line 650, in __protected_call__
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     return self.run(*args, **kwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/hg/kallithea/kallithea/lib/celerylib/__init__.py", line 67, in f_async
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     f_org(*args, **kwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "</home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/decorator.py:decorator-gen-6>", line 2, in send_email
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/hg/kallithea/kallithea/lib/celerylib/__init__.py", line 127, in __wrapper
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     ret = func(*fargs, **fkwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/hg/kallithea/kallithea/lib/celerylib/tasks.py", line 284, in send_email
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     email.utils.quote('%s (no-reply)' % author.full_name_or_username),
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: AttributeError: 'dict' object has no attribute 'full_name_or_username'

Attachments

Comments

Comment by Mads Kiilerich, on 2020-02-26 01:20

Can you give more details of how to reproduce the problem? It could seem like the stack trace miss the important parts of how it ended up that way.

Comment by vyom, on 2020-02-28 01:35

The send_mail function fails when I use @username in comments to notify the user of change. Probably the code invoking the send_mail do not include the user’s full_name or username.

When creating a pull request or adding reviewers the mail is send correctly.

Comment by Mads Kiilerich, on 2020-03-01 00:49

Comment by Mads Kiilerich, on 2020-03-01 00:50

Fixed