Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

nginx: Make uwsgi timeout shorter than nginx-to-uwsgi timeout.

Alex Vandiver1bd0ab506c7c
diff --git a/docs/production/reverse-proxies.md b/docs/production/reverse-proxies.md
index 5717637e3ff..45b8b65f080 100644
--- a/docs/production/reverse-proxies.md
+++ b/docs/production/reverse-proxies.md
@@ -255,13 +255,13 @@ things you need to be careful about when configuring it:
browsers. This [nginx code snippet][nginx-proxy-longpolling-config]
does this.
- The key configuration options are, for the `/json/events` and
- `/api/1/events` endpoints:
+ The key configuration options are:
- - `proxy_read_timeout 1200;`. It's critical that this be
- significantly above 60s, but the precise value isn't important.
- - `proxy_buffering off`. If you don't do this, your `nginx` proxy may
- return occasional 502 errors to clients using Zulip's events API.
+ - `proxy_read_timeout 1200;`. It's critical that this be significantly above
+ 60s, but the precise value isn't important. This is most important for the
+ events API, but must be applied to all endpoints.
+ - `proxy_buffering off`. If you don't do this, your `nginx` proxy may return
+ occasional 502 errors to clients using Zulip's events API.
1. The other tricky failure mode we've seen with `nginx` reverse
proxies is that they can load-balance between the IPv4 and IPv6
diff --git a/puppet/zulip/files/nginx/uwsgi_params b/puppet/zulip/files/nginx/uwsgi_params
index 09a10069326..47acef235ed 100644
--- a/puppet/zulip/files/nginx/uwsgi_params
+++ b/puppet/zulip/files/nginx/uwsgi_params
@@ -18,4 +18,8 @@ uwsgi_param HTTP_X_FORWARDED_PROTO $trusted_x_forwarded_proto;
uwsgi_param HTTP_X_FORWARDED_SSL "";
uwsgi_param HTTP_X_PROXY_MISCONFIGURATION $x_proxy_misconfiguration;
+# This value is the default, and is provided for explicitness; it must
+# be longer than the configured 55s "harakiri" timeout in uwsgi
+uwsgi_read_timeout 60s;
+
uwsgi_pass django;
diff --git a/puppet/zulip/templates/uwsgi.ini.template.erb b/puppet/zulip/templates/uwsgi.ini.template.erb
index 825d5785477..eab67bb1217 100644
--- a/puppet/zulip/templates/uwsgi.ini.template.erb
+++ b/puppet/zulip/templates/uwsgi.ini.template.erb
@@ -47,7 +47,7 @@ auto-procname=true
procname-prefix-spaced=zulip-django
# Longest response allowed, in seconds, before killing the worker
-harakiri=60
+harakiri=55