Forums

Unable to start an empty app #2

Hello again, and sorry for my English,

yesterday I created a topic here that my application (www.hvh-online.com /home/Lvadislav/hvh/network.py) stopped working unexpectedly, after that I tried to delete all the code from it, except for 5 lines, but it did not change anything:

from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
    return 'luck'

The server had been trying to start for 16 hours and suddenly started working, but today my application stopped working again for no reason, I again deleted all the code except for those 5 lines, but the server keeps trying to start. Again, like yesterday, if I paste this code into a new application, everything works.

I have an idea that this is due to the fact that I use multiprocessing.Manager to create shared chunks of memory, since multiprocessing errors appear before the server finally drops (they are not displayed in the logs because they are intercepted by my handlers).

Here is some errors from the /var/log/www.hvh-online.com.server.log

2018-02-05 12:30:01 *** uWSGI is running in multiple interpreter mode ***
2018-02-05 12:30:01 gracefully (RE)spawned uWSGI master process (pid: 2857)
2018-02-05 12:30:01 spawned uWSGI worker 1 (pid: 2906, cores: 1)
2018-02-05 12:30:01 fork(): Resource temporarily unavailable [core/master_utils.c line 729]
2018-02-05 12:30:01 fork(): Resource temporarily unavailable [core/master_utils.c line 729]
2018-02-05 12:30:01 metrics collector thread started
2018-02-05 12:30:01 pthread_create(): Resource temporarily unavailable [core/utils.c line 3816]
2018-02-05 12:30:01 !!! unable to spawn stats pusher thread !!!
2018-02-05 12:30:01 chdir(): No such file or directory [core/uwsgi.c line 1590]

That certainly sounds like it- keep in mind that for your webapps, we actually spin up multiple web workers for you to respond to incoming web requests- this means that you might not actually be able to share chunks of memory between the workers.

I've cleared down your straggler processes for you manually, but you will have to take out the multiprocessing code / tweak it if you want your webapp to run.

Okay, thanks for that.

My application is working fine with shared memory, but as I understood, the only reason is the processes that remain working after the reboot? Quick access to shared memory and the process on the background for me are very important, can I do it in another way?

Hi there, if you need to run "background" (asynchronous) processes from your web app, we have some pointers here: http://help.pythonanywhere.com/pages/AsyncInWebApps