1

我有一个 Django 应用程序,它连接到谷歌应用程序以发送电子邮件。但是,几天前我开始收到“对等连接重置”错误。有时有效,有时无效...我找不到任何理由证明无效...我正在使用 nginx 和 uwsgi。任何人都可以帮助我了解发生了什么以及如何解决它?

同样的应用程序运行了 1 个多月,现在才开始出现此错误。

这是日志:

    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日志:

2011/09/01 12:15:30 [error] 2221#0: *1379 readv() failed (104:

对等方重置连接)同时读取上游,客户端:187.115.25.63,服务器:www.site.com,请求:“POST /ems/ HTTP/1.0”,上游:“uwsgi://127.0.0.1:9001”,主机:“www.site.com”,推荐人:“http://www.site.com/ems/”

4

1 回答 1

5

在关闭与 nginx 的连接之前,您似乎没有阅读后期数据。

如果您无法修改您的应用程序,请尝试将 --post-buffering 8192 添加到您的 uWSGI 命令行以强制 UWSGI 自动读取 post-data

于 2011-09-02T03:55:14.627 回答