Is A 502 Whenever Someone Uploads A Big File My Hosts Fault Or MINE?

Solved502nginxreverse-proxy4 replies · 133 views · started
Accepted solution by Erik Sato — oof look for the kernels OOM killer: dmesg T grep i E 'killed process out of memory', small VPSes kill PHP FPM workers, Node or database…
  1. Woke up to monitoring alerts and this lovely page on every URL:

    It's Apache proxying to Gunicorn, and it seems to happen whenever someone uploads a big file. The error log mentions the upstream a lot but I'm not sure if that's the cause or just a symptom. I want to fix this properly instead of adding a cron job that restarts services every hour. Where do I start? I'll happily post whatever logs would help narrow this down.

    0
  2. does dmesg show anything about processes being killed for memory? ?

    thinking

    13 0 helpful
  3. ahh right error log shows the proxy getting connection refused from the Gunicorn upstream every time, whenever someone uploads a big file.

    facepalm

    13 0 helpful
  4. Check the app service right after a 502: systemctl status php*-fpm, systemctl status yourapp, or docker compose ps. If it shows restarts or exited state, read its own logs with journalctl -u yourapp -n 200 or docker compose logs app. The real error lives there, not in the proxy log. good luck man!

    2 1 helpful
  5. Accepted solution

    oof look for the kernels OOM killer: dmesg -T | grep -i -E 'killed process|out of memory', small VPSes kill PHP-FPM workers, Node or database processes under load, which produces 502s during traffic spikes... add swap, reduce worker counts, or move to a bigger plan.

    lol

    29 7 helpful

Reply to this topic

Sign in or create an account to reply.