Django 502 Bad Gateway nginx/1.14.2
I continuously run into this error in my browser: 502 Bad Gateway nginx/1.14.2 and this in my Django console: [2023-06-30 09:16:33 +0000] [31561] [WARNING] Worker with pid 31565 was terminated due to signal 9
[2023-06-30 09:16:33 +0000] [31567] [INFO] Booting worker with pid: 31567. This happens when I upload files larger than 10 MB or when I try to create graphs that are relatively large. On my development server (local host) everything works perfectly. Does this mean I need to upgrade my Linode server to have more RAM? I currently have 2 GB RAM.
1 Reply
Usually when you see a warning like this:
[31561] [WARNING] Worker with pid 31565 was terminated due to signal 9
That means that your service is being terminated due to running out of memory (OOM killed).
Looking at this FAQ, they mention that you may see a 502 error returned to the client if you are using Nginx. A common cause for this is when the OOM killer terminates a process due to low memory condition.
So yes, I believe the most straightforward way of solving this issue would be to resize your Linode to a plan that has more RAM.
However, if you would like to investigate which active processes are taking up the most resources, you can run the top command. You can find more information about top in our guide on our website.
We also have a Community Site Post where we give some suggestions if you keep running out of memory.
Hopefully these links point you in the right direction.