Skip to content

Commit a2e62a0

Browse files
claudefrousselet
authored andcommitted
fix: add --preload to Gunicorn to prevent worker timeout on startup
Without --preload, each Gunicorn sync worker independently loads the Django WSGI application after forking. During this loading phase, the worker does not send heartbeats to the arbiter. On resource-constrained environments (staging, small Docker containers), this loading can exceed the 120-second timeout, causing the arbiter to kill the worker with WORKER TIMEOUT before it ever serves a request. With --preload, the application is loaded once in the master process before forking workers. Workers start with the app already loaded, eliminating the startup timeout risk. https://claude.ai/code/session_01AztUaxUwQFtPfzRVyDzeNz
1 parent 4a49f87 commit a2e62a0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ CMD ["gunicorn", "core.wsgi:application", \
2929
"--worker-tmp-dir", "/dev/shm", \
3030
"--workers", "3", \
3131
"--timeout", "120", \
32+
"--preload", \
3233
"--forwarded-allow-ips", "*", \
3334
"--access-logfile", "-"]

0 commit comments

Comments
 (0)