DjangoGunicorn

Gunicorn workers killed by OOM causing Bad Gateway errors

critical
Resource ContentionUpdated Aug 23, 2025(via Exa)
How to detect:

Django app returns 'Bad Gateway' errors due to Gunicorn workers being killed by the kernel's OOM killer from memory exhaustion. Check dmesg for 'killed process' messages indicating OOMKilled processes.

Recommended action:

Check dmesg with `dmesg | grep -i "killed process"` to confirm OOM kills. Monitor memory with htop. Set memory limits in systemd service configuration. Reduce number of Gunicorn workers or increase server RAM. Calculate workers as: (2 × CPU cores) + 1.