Forums

uWSGI Server Issues (Sockets occasionally get removed)

Hey admins, it seems like every once in a while my Flask app just gets shut down (socket removed). There isn't a helpful error related specifically to my code, so is it something with the uWSGI server itself?

Whenever the app gets shut down, my logs don't show the app restarting for anywhere between 5-10 hours later. Really need your help to diagnose this. My app servers as a middle-man app to contacting backend servers of a live game so there can't be hours of gaps.

2023-11-25 14:47:58 ...brutally killing workers...
2023-11-25 14:47:58 Sat Nov 25 14:47:58 2023 - received message 0 from emperor
2023-11-25 14:48:05 uwsgi_master_manage_emperor()/read(): Bad file descriptor [core/emperor.c line 2442]
2023-11-25 14:48:05 lost connection with my emperor !!!
2023-11-25 14:48:05 VACUUM: unix socket /var/sockets/continuumxr.pythonanywhere.com/socket removed.

If our system has to shut down your website for any reason, it will be started up again right away the next time a request comes in. Are you seeing any indication that the site is actually down? It might be that it's being shut down, but then started again 5-10 hours later because that is when you receive your next request.

We receive ~300 endpoint hits per minute since it is a live multiplayer game on the Meta Oculus store. So, no 5-10 hour delay on receiving requests.

Are there other reasons the system wouldn't start up again right away? Is there a built-in or convenient way to check if the uWSGI server is live or if a socket has been removed? Or an external service that can ping my app and inform me I need to go hit Reload manually?

You can use Always-on task to monitor your web app or an external system like pingdom or something similar.