Forums

Server keeps re-starting, always w/ error

As of late, my server is not coming up anymore. I already stripped all from *_wsgi.py to make sure no code issue is in the way, but that did not help. Server starts up fine until this, then reboots every ~45s:

2016-12-28 10:22:41 *** uWSGI is running in multiple interpreter mode ***
2016-12-28 10:22:41 spawned uWSGI master process (pid: 17646)
2016-12-28 10:22:41 fork(): Resource temporarily unavailable [core/master_utils.c line 724]
2016-12-28 10:22:41 metrics collector thread started
2016-12-28 10:22:41 pthread_create(): Resource temporarily unavailable [core/utils.c line 3785]
2016-12-28 10:22:41 !!! unable to spawn stats pusher thread !!!
2016-12-28 10:22:41 chdir(): No such file or directory [core/uwsgi.c line 1541]
2016-12-28 10:22:41 VACUUM: unix socket /var/sockets/tomtom101.pythonanywhere.com/socket removed.

I thought I had nailed the problem when I run _wsgi.py in the console when it warned my about a UTF8 char w/o having defined encoding (all true). The error went away after I declared the encoding, but the server still keeps restarting. Maybe it still did not recover from that?

Thanks! t

Thanks for letting us know -- it looks like a number of processes piled up while it was broken, so I've cleared them down. It looks like it's up and running now, though it did take a surprisingly long time to start running, and the front page of the site is blank, so I'm not sure it's OK -- let me know if it's not.

Thanks for looking into this so fast! It seems it spends most its time killing workers. When I run my *_wsgi.py script in the shell, it takes ~11s to load, which seems reasonable. However whenever I try to restart the site, it spends 1 min "gracefully killing workers" before it times-out and leaves me with the "There was a problem. If this keeps happening, please send us feedback." message. It seem it never manages to actually kill the workers since when I hit restart right after that, it again spends its one minute on killing workers.

What I see now in the logs is

2016-12-28 21:21:55 *** Starting uWSGI 2.0.5.1 (64bit) on [Wed Dec 28 21:21:42 2016] ***

as the first message to the last one in the very same second:

2016-12-28 21:21:55 spawned 2 offload threads for uWSGI worker 1

No more loyalty to the Emperor :(

What I have done now is do the heavy lifting on the first request, so my wsgi script runs in 2s instead of 11s. While the first request is expectedly slow, it seems to run fine from the second on. Seems to play nice that way!

Thanks for your help!

Cool. Glad you worked it out.