From e0add9837523d7f30d4c07951d9e13dc9a56200a Mon Sep 17 00:00:00 2001 From: Matthew Curran Date: Tue, 27 Oct 2026 13:05:16 -0400 Subject: [PATCH 1/2] gwy: Tweaks to try to deal with 502 bad gateway errors when uploading many files. --- gateway/compose/production/django/start | 1 + gateway/pyproject.toml | 3 ++- gateway/uv.lock | 25 ++++++++++++++++++++++++- network/traefik/conf.d/00-tls.toml | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gateway/compose/production/django/start b/gateway/compose/production/django/start index 9f75154ba..2c0f9a911 100644 --- a/gateway/compose/production/django/start +++ b/gateway/compose/production/django/start @@ -35,6 +35,7 @@ function main() { --bind 0.0.0.0:18000 \ --timeout 605 \ --graceful-timeout 605 \ + --keep-alive 65 \ --chdir=/app -k uvicorn_worker.UvicornWorker || { echo_wait_and_quit "Gunicorn server failed." } diff --git a/gateway/pyproject.toml b/gateway/pyproject.toml index bdd44a5de..ae1e1dbfa 100644 --- a/gateway/pyproject.toml +++ b/gateway/pyproject.toml @@ -62,7 +62,8 @@ "uvicorn>=0.32.0", "uvicorn-worker>=0.2.0", "whitenoise>=6.7.0", - ] + "httptools>=0.9.0", +] [project.optional-dependencies] local = [ diff --git a/gateway/uv.lock b/gateway/uv.lock index 1ed60ce28..c3324f16b 100644 --- a/gateway/uv.lock +++ b/gateway/uv.lock @@ -3,7 +3,7 @@ revision = 3 requires-python = "==3.13.*" [options] -exclude-newer = "2026-08-06T13:57:40.197413Z" +exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values. exclude-newer-span = "P1W" [[package]] @@ -1085,6 +1085,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/84/f9/534c2a89b24445a9a9623beb4697fd72b8c8f16286f6f3bda012c7af004a/hiredis-3.3.1-cp313-cp313-win_amd64.whl", hash = "sha256:d8e56e0d1fe607bfff422633f313aec9191c3859ab99d11ff097e3e6e068000c", size = 22383, upload-time = "2026-03-16T15:20:01.865Z" }, ] +[[package]] +name = "httptools" +version = "0.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/3a/ec/deed52912ab7ca6c0b12859330c571c60c61d7267b341b28951fcbf13694/httptools-0.9.0.tar.gz", hash = "sha256:d484ebb7e3a3f3597b0f645fbd1b85633674ca808c1f5ba11c2caf7c66f5c8b6", size = 282523, upload-time = "2026-10-09T19:57:04.301Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9c/04/223994f8589750d2a36ceb43203e739cf75bd9e12c226680d73567766908/httptools-0.9.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4fb995082fe41ec410b33c48b54fb1d44abb8a6ee762c31e8c42519e8c3a30a9", size = 117115, upload-time = "2026-10-09T19:54:53.356Z" }, + { url = "https://files.pythonhosted.org/packages/31/d8/b4407836e567a862ce79d78a628d785db99aba52e63496d68c60eed0d475/httptools-0.9.0-cp313-cp313-macosx_11_0_x86_64.whl", hash = "sha256:b9cd15cb7cf0d5cc41f649fd789aae12c56c3b83eff593f8e095c1d4555ad5c3", size = 113225, upload-time = "2026-10-09T19:54:54.81Z" }, + { url = "https://files.pythonhosted.org/packages/79/f6/0caa51b077492a7306bdbd9dfb907a2246985f0aed1fe2d086255921848b/httptools-0.9.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:088de1738e1af624466a01c35d652dbe6fb825be887c76d68aa850621d81db88", size = 520112, upload-time = "2026-10-09T19:54:56.3Z" }, + { url = "https://files.pythonhosted.org/packages/fa/da/7a47b7c2106bb10e6d4c04a139d045257a4f93c672fae6f0b9e92b1f7bc2/httptools-0.9.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b1ac7f1bc6c0dbf90684b77571a51a21b2463909fd916ce0ac9bfc4d566dc75", size = 516079, upload-time = "2026-10-09T19:54:57.938Z" }, + { url = "https://files.pythonhosted.org/packages/0f/4d/417b42d2663acf4f5aeb2718dc894ec2be4e3dcfd8caa2d3bf9ee2dce511/httptools-0.9.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b9430f65db521db7962ad951571d446171213686f96c998a54dc18ed574821e2", size = 535040, upload-time = "2026-10-09T19:54:59.769Z" }, + { url = "https://files.pythonhosted.org/packages/cb/de/8df4c09a33ddaf50f697719f20201cf93631ef4b50cec05e42acf179a7c1/httptools-0.9.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:52fe0176682a25b15370f23f5b0f1366a84771df89144fb0cd979cb72a94b5ca", size = 462799, upload-time = "2026-10-09T19:55:01.673Z" }, + { url = "https://files.pythonhosted.org/packages/e8/90/1bfe91e3fca29c541d85d7ba8ed92a406d4dd13608c281baf7ec75369fec/httptools-0.9.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:757e3f79cb865a7db94e0db5f4d0ed3284a69e39d53568f433982ea13c60cac1", size = 497596, upload-time = "2026-10-09T19:55:03.201Z" }, + { url = "https://files.pythonhosted.org/packages/b0/af/2bbd5af0dd7a0e0c3b63bfefafd87a07041eb13d7cd710fbf30708b70773/httptools-0.9.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:6ff5f0ed70783dcb9562dbd20edca51c3d4d277f128223709e3da6b75986d1d4", size = 517110, upload-time = "2026-10-09T19:55:05.011Z" }, + { url = "https://files.pythonhosted.org/packages/d4/7a/9f165817c3e27df9098f3d50a675417d8721253f1073434f48a3f9d9a6c2/httptools-0.9.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:c0f537e5e8152e8d9cae82804024790cb973061abd3b7ef8f66f46e2b5c7bb51", size = 459198, upload-time = "2026-10-09T19:55:06.985Z" }, + { url = "https://files.pythonhosted.org/packages/93/20/b93279e334946c359d39aaf405241c6fd60f9e60da709bc4156731a4413c/httptools-0.9.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:1a7f1df31829c258158be01bb04eb668c4fba7df1ddf2262131a972962e651b6", size = 502996, upload-time = "2026-10-09T19:55:08.733Z" }, + { url = "https://files.pythonhosted.org/packages/86/c9/ac3657943d40c5a9949b72565ee03151e480fb18c062c7c13c0c0276df6f/httptools-0.9.0-cp313-cp313-win32.whl", hash = "sha256:714bf348f468532d86bed670837e7d5ddff3834dd7f5d3c08066da400c86f088", size = 85878, upload-time = "2026-10-09T19:55:10.275Z" }, + { url = "https://files.pythonhosted.org/packages/74/69/d23079cd4bc16d11e49c3f51c2540c018736f26701a2a73183cae9255a1c/httptools-0.9.0-cp313-cp313-win_amd64.whl", hash = "sha256:805b0f2618e5d4c3e28f45b731eb1a0539691ae4a2f97b4ce014de0bf96a1ff5", size = 91549, upload-time = "2026-10-09T19:55:11.701Z" }, + { url = "https://files.pythonhosted.org/packages/0b/ed/5ff678a774b721f054c095f04d84fc536e7369ea4f4c9af3813a518d95b6/httptools-0.9.0-cp313-cp313-win_arm64.whl", hash = "sha256:bfdabac0c6d3d6a5be8c2a100a001c92c14a39bbafd5999545a675c493626e64", size = 88043, upload-time = "2026-10-09T19:55:13.046Z" }, +] + [[package]] name = "humanize" version = "4.15.0" @@ -2118,6 +2139,7 @@ dependencies = [ { name = "fido2" }, { name = "flower" }, { name = "h5py" }, + { name = "httptools" }, { name = "ijson" }, { name = "loguru" }, { name = "matplotlib" }, @@ -2200,6 +2222,7 @@ requires-dist = [ { name = "flower", specifier = ">=2.0.1" }, { name = "gunicorn", marker = "extra == 'production'", specifier = ">=23.0.0" }, { name = "h5py", specifier = ">=3.12.1" }, + { name = "httptools", specifier = ">=0.9.0" }, { name = "ijson", specifier = ">=3.2.0" }, { name = "loguru", specifier = ">=0.7.2" }, { name = "matplotlib", specifier = ">=3.10.5" }, diff --git a/network/traefik/conf.d/00-tls.toml b/network/traefik/conf.d/00-tls.toml index 4b5ab2034..76469ea22 100644 --- a/network/traefik/conf.d/00-tls.toml +++ b/network/traefik/conf.d/00-tls.toml @@ -9,6 +9,7 @@ [tls.options] [tls.options.default] minVersion = "VersionTLS12" + sniStrict = true [tls.stores] # Fallback when Let's Encrypt is unavailable (curl may need --insecure). From 60ecbd4a935715608e929ccce644b009091da620 Mon Sep 17 00:00:00 2001 From: Matthew Curran Date: Tue, 27 Oct 2026 13:27:34 -0400 Subject: [PATCH 2/2] gwy: Update gunicorn keepalive timeout --- gateway/compose/production/django/start | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway/compose/production/django/start b/gateway/compose/production/django/start index 2c0f9a911..cd06db5d3 100644 --- a/gateway/compose/production/django/start +++ b/gateway/compose/production/django/start @@ -35,7 +35,7 @@ function main() { --bind 0.0.0.0:18000 \ --timeout 605 \ --graceful-timeout 605 \ - --keep-alive 65 \ + --keep-alive 95 \ --chdir=/app -k uvicorn_worker.UvicornWorker || { echo_wait_and_quit "Gunicorn server failed." }