From cd530d627bb7f675098bfc5512a02fda34c03d64 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 30 Jul 2020 23:41:19 -0700 Subject: [PATCH] uwsgi: Stop generating IOError and SIGPIPE on client close. Clients that close their socket to nginx suddenly also cause nginx to close its connection to uwsgi. When uwsgi finishes computing the response, it thus tries to write to a closed socket, and generates either IOError or SIGPIPE failures. Since these are caused by the _client_ closing the connection suddenly, they are not actionable by the server. At particularly high volumes, this could represent some sort of server-side failure; however, this is better detected by examining status codes at the loadbalancer. nginx uses the error code 499 for this occurrence: https://httpstatuses.com/499 Stop uwsgi from generating this family of exception entirely, using configuration for uwsgi[1]; it documents these errors as "(annoying)," hinting at their general utility." [1] https://uwsgi-docs.readthedocs.io/en/latest/Options.html#ignore-sigpipe --- puppet/zulip/templates/uwsgi.ini.template.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/puppet/zulip/templates/uwsgi.ini.template.erb b/puppet/zulip/templates/uwsgi.ini.template.erb index bda9117121..da9b415c80 100644 --- a/puppet/zulip/templates/uwsgi.ini.template.erb +++ b/puppet/zulip/templates/uwsgi.ini.template.erb @@ -13,3 +13,7 @@ post-buffering=4096 env= LANG=en_US.UTF-8 uid=zulip gid=zulip + +ignore-sigpipe = true +ignore-write-errors = true +disable-write-exception = true