在过去的几周里,我的一个基于uwsgi的heroku web dynos已经进入了一个失败的状态,只有重新启动才能解决问题。以下是我在dyno进入此状态时几乎每个请求都会看到的日志:
Dec 18 17:44:43 my-heroku heroku/router: at=error code=H13 desc="Connection closed without response" method=GET path="/heartbeat/" host=mytestsite.com request_id=bd5ff8cf-7c38-4863-bf1a-08b4c6a73a90 fwd="54.0.0.1" dyno=web.1 connect=2ms service=3ms status=503 bytes=0
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add REQUEST_METHOD=GET to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add REQUEST_URI=/heartbeat/ to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add PATH_INFO=/heartbeat/ to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add QUERY_STRING= to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add SERVER_PROTOCOL=HTTP/1.1 to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add SCRIPT_NAME= to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add SERVER_NAME=blahblah-2fd4-4b3c-8fbb-32c6e3c1a782 to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add SERVER_PORT=49737 to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add REMOTE_ADDR=10.254.1.80 to uwsgi packet, consider increasing buffer size
Dec 18 17:44:43 my-heroku app/web.1: [WARNING] unable to add HTTP_HOST: bla=blah.mysite.com to uwsgi packet, consider increasing buffer size`
这是我的uwsgi.ini文件:
[uwsgi]
#heroku setup: see https://github.com/unbit/uwsgi-docs/blob/master/tutorials/heroku_python.rst
http-socket = :$(PORT)
processes = 5
master = true
die-on-term = true
harakiri = 20
harakiri-verbose
reload-mercy = 8
max-requests = 2000
# the below is required by new relic. be sure to monitor your system
# https://newrelic.com/docs/python/python-agent-and-uwsgi
enable-threads = true
single-interpreter = true
# the module
module = publisher.wsgi
这段时间内的Dyno内存使用率约为512 MB的450MB。
我的问题是:这个失败的状态是什么(无法向数据包添加任何东西)的症状是什么?可能会导致uWSGI或我的heroku dyno进入这个失败的状态?
然后:有什么修复?我应该将buffer-size
设置为配置中的某些内容吗?如果是,那么在heroku服务器上它的适当值是什么?