{"action":"created","issue":{"url":"https://api.github.com/repos/unbit/uwsgi/issues/1623","repository_url":"https://api.github.com/repos/unbit/uwsgi","labels_url":"https://api.github.com/repos/unbit/uwsgi/issues/1623/labels{/name}","comments_url":"https://api.github.com/repos/unbit/uwsgi/issues/1623/comments","events_url":"https://api.github.com/repos/unbit/uwsgi/issues/1623/events","html_url":"https://github.com/unbit/uwsgi/issues/1623","id":254277060,"node_id":"MDU6SXNzdWUyNTQyNzcwNjA=","number":1623,"title":"Unexplainable timeout error when using uwsgi behind nginx","user":{"login":"bow","id":343998,"node_id":"MDQ6VXNlcjM0Mzk5OA==","avatar_url":"https://avatars1.githubusercontent.com/u/343998?v=4","gravatar_id":"","url":"https://api.github.com/users/bow","html_url":"https://github.com/bow","followers_url":"https://api.github.com/users/bow/followers","following_url":"https://api.github.com/users/bow/following{/other_user}","gists_url":"https://api.github.com/users/bow/gists{/gist_id}","starred_url":"https://api.github.com/users/bow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bow/subscriptions","organizations_url":"https://api.github.com/users/bow/orgs","repos_url":"https://api.github.com/users/bow/repos","events_url":"https://api.github.com/users/bow/events{/privacy}","received_events_url":"https://api.github.com/users/bow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2017-08-31T09:46:05Z","updated_at":"2018-08-22T09:53:42Z","closed_at":null,"author_association":"NONE","body":"Hi everyone,\r\n\r\nI'm using uwsgi (version 2.0.13.1) behind nginx (version 1.10.3) to run a Flask application on Python 3 on Ubuntu 14.04.03. The connection to nginx is done via https, but nginx connects to uwsgi via an IPC socket (config below).\r\n\r\nI've been getting some timeout errors from nginx that I can't explain. Here are some examples:\r\n\r\n```\r\n2017/08/17 17:38:02 [error] 22887#22887: *613 upstream timed out (110: Connection timed out) while reading response header from upstream, client: <CLIENT_IP>, server: _, request: \"POST <URL> HTTP/1.1\r\n2017/08/31 10:39:22 [error] 5904#5904: *464 upstream timed out (110: Connection timed out) while reading response header from upstream, client: <CLIENT_IP>, server: _, request: \"POST <URL> HTTP/1.1\r\n```\r\n\r\nHere's my uwsgi config file:\r\n\r\n```\r\n[uwsgi]\r\nmodule = wsgi:create_app()\r\n\r\nmaster = true\r\nprocesses = 5\r\n\r\nsocket = /tmp/app.sock\r\nchown-socket = app_user:www-data\r\nchmod-socket = 660\r\nsocket-timeout = 60\r\nharakiri = 60\r\nvacuum = true\r\n\r\nenable-threads = true\r\ndie-on-term = true\r\nsingle-interpreter = true\r\nharakiri-verbose = true\r\n\r\nlogger = rsyslog:localhost:514,app-uwsgi,14\r\nstats = 127.0.0.1:9090\r\n```\r\n\r\nAnd here's my uwsgi_params settings in nginx:\r\n\r\n```\r\n        include                         uwsgi_params;\r\n        uwsgi_param                     X-Real-IP $remote_addr;\r\n        uwsgi_param                     X-Forwarded-For $proxy_add_x_forwarded_for;\r\n        uwsgi_param                     X-Forwarded-Proto $http_x_forwarded_proto;\r\n        uwsgi_pass                      unix:/tmp/app.sock;\r\n        uwsgi_read_timeout              60;\r\n        uwsgi_send_timeout              60;\r\n```\r\n\r\nThe error occurs randomly. With the exact same payload, the first request could result in an error, but sending it again it could work fine. So I'm not exactly sure if increasing the timeout would help.\r\n\r\nWhat I also don't understand are also these parts of the log messages:\r\n    \r\n    22887#22887: *613 upstream timed out \r\n\r\nWhat does `22887#22887` mean? Why does it say `*613 upstream ..`? These numbers are always different per error message.\r\n\r\nAnd ultimately, is there a way to reproduce this reliably and then fix it?"},"comment":{"url":"https://api.github.com/repos/unbit/uwsgi/issues/comments/414978364","html_url":"https://github.com/unbit/uwsgi/issues/1623#issuecomment-414978364","issue_url":"https://api.github.com/repos/unbit/uwsgi/issues/1623","id":414978364,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDk3ODM2NA==","user":{"login":"Poply","id":3848166,"node_id":"MDQ6VXNlcjM4NDgxNjY=","avatar_url":"https://avatars2.githubusercontent.com/u/3848166?v=4","gravatar_id":"","url":"https://api.github.com/users/Poply","html_url":"https://github.com/Poply","followers_url":"https://api.github.com/users/Poply/followers","following_url":"https://api.github.com/users/Poply/following{/other_user}","gists_url":"https://api.github.com/users/Poply/gists{/gist_id}","starred_url":"https://api.github.com/users/Poply/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Poply/subscriptions","organizations_url":"https://api.github.com/users/Poply/orgs","repos_url":"https://api.github.com/users/Poply/repos","events_url":"https://api.github.com/users/Poply/events{/privacy}","received_events_url":"https://api.github.com/users/Poply/received_events","type":"User","site_admin":false},"created_at":"2018-08-22T09:53:42Z","updated_at":"2018-08-22T09:53:42Z","author_association":"NONE","body":"@salilsethi \r\n\r\nThanks. Removing the master setting is what fixed my issue.\r\n\r\nSetup:\r\nFlask application behind nginx using Flask-mail to send mail through my mxroute email server on a google cloud VM.\r\n\r\nFor a while I thought it was something on Google's side blocking my emails. However I could send my emails fine when I used flask's built-in server running on the Google VM.\r\n\r\nPython 3.5.3\r\nFlask 0.12.2\r\nnginx 1.12.2\r\nFlask-mail 0.9.1\r\nCentOS 7.3\r\nuWSGI 2.0.17"}}
{"actor":{"display_login":"Poply"}}