openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.45k stars 3.88k forks source link

Sending email issues #3743

Closed defance closed 10 years ago

defance commented 10 years ago

Here I am again. I am on my way installing yet another copy of edx-platform (not-so-new version, but I serached through latest commits, found nothing that could help)

Summary: emals are not sent.

I got following error with stack trace.

If course does not have unicode characters in its title

[2014-05-15 12:43:45,143: INFO/MainProcess] bulk_email.tasks.send_course_email[1e50ba65-bb36-47b9-955a-d98377097a6f]: Preparing to send email 168 to 1 recipients as subtask 1e50ba65-bb36-47b9-955a-d98377097a6f for instructor task 168: context = {u'platform_name': u'edX', u'account_settings_url': u'http://localhost/dashboard', u'course_image_url': u'http://localhost/c4x/qaz/cs101/asset/images_course_image.jpg', u'course_title': u'test course', u'course_url': u'http://localhost/courses/qaz/cs101/2011/'}, status=SubtaskStatus<{'skipped': 0, 'retried_nomax': 0, 'task_id': u'1e50ba65-bb36-47b9-955a-d98377097a6f', 'succeeded': 0, 'retried_withmax': 0, 'attempted': 0, 'failed': 0, 'state': u'QUEUING'}>
[2014-05-15 12:43:45,152: ERROR/MainProcess] bulk_email.tasks.send_course_email[1e50ba65-bb36-47b9-955a-d98377097a6f]: Task 1e50ba65-bb36-47b9-955a-d98377097a6f: email with id 168 caused send_course_email task to fail with unexpected exception.  Generating retry.
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/tasks.py", line 438, in _send_course_email
    connection.open()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 48, in open
    local_hostname=DNS_NAME.get_fqdn())
  File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 309, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
error: Int or String expected

When course does have unicode characters in title

[2014-05-15 12:40:16,373: INFO/MainProcess] bulk_email.tasks.send_course_email[f9c6a2ed-2376-4bdf-8618-43c51a0fdc59]: Preparing to send email 167 to 1 recipients as subtask f9c6a2ed-2376-4bdf-8618-43c51a0fdc59 for instructor task 167: context = {u'platform_name': u'edX', u'account_settings_url': u'http://localhost/dashboard', u'course_image_url': u'http://localhost/c4x/ITMO/x0001.01/asset/images_course_image.jpg', u'course_title': u'\u0422\u0435\u043e\u0440\u0438\u044f', u'course_url': u'http://localhost/courses/XXX/x0001.01/2014/'}, status=SubtaskStatus<{'skipped': 0, 'retried_nomax': 0, 'task_id': u'f9c6a2ed-2376-4bdf-8618-43c51a0fdc59', 'succeeded': 0, 'retried_withmax': 0, 'attempted': 0, 'failed': 0, 'state': u'QUEUING'}>
2014-05-15 12:40:16,383 ERROR 32373 [dd.dogapi] statsd.py:31 - couldnt submit statsd point
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/dogapi/stats/statsd.py", line 29, in add_point
    self.socket_sendto(payload, self.address)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 45-50: ordinal not in range(128)
[2014-05-15 12:40:16,384: ERROR/MainProcess] bulk_email.tasks.send_course_email[f9c6a2ed-2376-4bdf-8618-43c51a0fdc59]: Task f9c6a2ed-2376-4bdf-8618-43c51a0fdc59: email with id 167 caused send_course_email task to fail with unexpected exception.  Generating retry.
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/tasks.py", line 438, in _send_course_email
    connection.open()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 48, in open
    local_hostname=DNS_NAME.get_fqdn())
  File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 309, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
error: Int or String expected

I double checked my config, I did enable bulk_email, lms.env.json is like:

{
    ...
    "EMAIL_USE_TLS": false,
    "EMAIL_HOST": "***",
    "EMAIL_PORT": 25,
    "BULK_EMAIL_DEFAULT_FROM_EMAIL": "no-reply@***"
}

I concealed host name is order to keep privacy, they are working fine (did pretty ok with lms.auth.json too), same configuration is used in another instance of edx, mail are doing fine there.

Any ideas?

singingwolfboy commented 10 years ago

Have you been able to reproduce this issue on the latest version of the codebase?

defance commented 10 years ago

It pretty looks like phantom pain. Some magic like restoring VM from older back-up, rebooting VM and services etc. have made it. And letters started being sent and delivered. May be I will research this later, trying to reproduce such behaviour once more. For now it is not an issue anymore.