My Flask app is taking forever to start

I have a Flask app that is running alongside a Discord bot, and the app is taking forever to start. No error message, nothing. Just the blank “Starting…” screen. The Discord bot is working completely fine, it’s the app that has the problem. What is going on? Would it help to put the bot and the app in a different project?

Link to project

The app

And sometimes it does load, and it shows this in the logs:

Your app is taking a while to stop...
Your app did not stop in 5 seconds, forcing exit.

What does this mean?

Separated the bot and the app, and it works fine now!

this is when glitch has started the project container, the install command has finished, it has run the start command, and it is waiting for the app to start listening for http.

if you’re having this problem, see if you call follow through your project’s and see if it’s correctly getting to the point of listening.

glitch sometimes wants to stop your app. this happens including when you edit the project and it needs to restart it. it stops the running program(s) first so that you don’t get multiple copies running at the same time.

to stop the app, it sends a signal to each user process (was it sigterm? check me on this). then, it waits for the processes to exit. it detects when the processes have exited by checking if the project container has a certain number of processes running, corresponding to glitch’s own in-container software. if you have programs that don’t exit after being signaled or if you launch other processes during that time, it’ll interfere with this stopping procedure.

1 Like