Error: readv() failed (104: Connection reset by peer) while reading upstream

泪湿孤枕 提交于 2019-12-21 10:51:08

问题


I have facebook apps with flask with nginx and uwsgi. When it receive POST from facebook, it always has error:

readv() failed (104: Connection reset by peer) while reading upstream

But when I access my apps directly (with GET method), it ran smoothly. What I've done:

  1. Limit @app.route with POST method only - doesn't work.
  2. Add limit in wsgi: uwsgi_buffer_size (in case request from facebook is big), and uwsgi_harakiri (in case uwsgi provide timeout before finish it request) - doesn't work.

I have workaround in django but can't figure out yet how to implement in flask. Could anyone help please?


回答1:


This is the bug of uwsgi. You can get more from [uWSGI] Several bugs .

The simple solution is that you must read the POST body by wsgi.input, even through POST body is null or you don't need POST params.




回答2:


The issue is that "upstream" (the actual process that nginx is proxing) is closing the connection.

In my case, Django is my web server and I needed to set DATA_UPLOAD_MAX_NUMBER_FIELDS to be larger because there were too many fields in the POST request.



来源:https://stackoverflow.com/questions/10393203/error-readv-failed-104-connection-reset-by-peer-while-reading-upstream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!