I have a Django application that connect to google apps to send emails. However, few days ago I started to get "Connection reset by peer" error. Sometimes it works, sometimes not... I couldn't find any reason to justify when not works... I am using nginx and uwsgi. Can anybody help me to understand whats going on and how to resolve it?
This same application is running more than 1 month and just now started to give this error.
Here is the log:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/utils/decorators.py", line 93, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/contrib/auth/views.py", line 155, in password_reset
form.save(**opts)
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/contrib/auth/forms.py", line 147, in save
t.render(Context(c)), from_email, [user.email])
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/mail/__init__.py", line 61, in send_mail
connection=connection).send()
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/mail/message.py", line 251, in send
return self.get_connection(fail_silently).send_messages([self])
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/mail/backends/smtp.py", line 90, in send_messages
self.close()
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/mail/backends/smtp.py", line 58, in close
self.connection.quit()
File "/usr/lib/python2.6/smtplib.py", line 730, in quit
res = self.docmd("quit")
File "/usr/lib/python2.6/smtplib.py", line 363, in docmd
return self.getreply()
File "/usr/lib/python2.6/smtplib.py", line 337, in getreply
line = self.file.readline()
File "/usr/lib/python2.6/smtplib.py", line 177, in readline
chr = self.sslobj.read(1)
File "/usr/lib/python2.6/ssl.py", line 136, in read
return self._sslobj.read(len)
error: [Errno 104] Connection reset by peer
nginx log:
2011/09/01 12:15:30 [error] 2221#0: *1379 readv() failed (104:
Connection reset by peer) while reading upstream, client: 187.115.25.63, server: www.site.com, request: "POST /ems/ HTTP/1.0", upstream: "uwsgi://127.0.0.1:9001", host: "www.site.com", referrer: "http://www.site.com/ems/"