Gunicorn timeout not working in flask server depolyment
i have a flask app, and i'm trying to run it on railway. However the flask server doesn't run before loading Machine learning models and data, which takes a few seconds. And in Gunicorn, this causes a restart unless a timeout is specified. i tried this on a linux machine,and it worked fine, but on railway it doesn't work, the server keeps failing
27 Replies
Project ID:
f200b0e7-24e4-4acc-8c43-179d952e64a9
f200b0e7-24e4-4acc-8c43-179d952e64a9
what's your current start command?
Im using "Gunicorn -b 0.0.0.0:5000 app:app --timeout 600", and it still fails almost immediately
show me the deploy logs please
here are the deploy logs
this has nothing to do with gunicorn?
no these are warnings, the server should start even with this message
well its obviously not starting lol
how big is your model file
lol..yeah... the model file is about 10Mb actually, but it still takes a second to load up for some reason
i worked around it by introducing a timeout, and it works. But apparently not on railway
i think maybe there could be an overiding configuration for gunicorn
i dont see any gunicorn errors in your logs
so this is likely a code issue, with an error you arent logging
the same setup works fine when i run it on linux with gunicorn
without containerizing it ie.
that does not mean its a railway problem
theres not much i can do to help you unless i can see some error logs
i used the same start command (Gunicorn -b 0.0.0.0:5000 app:app --timeout 600) in the "Build Command" and it worked, only it got stuck because the server was running in the build logs and it never made it to the depoly stage
i think that is worth mentioning
^
ok, i'll see how i can get some. Thanks alot.
i just upgraded to hobby and tried it, and it worked...
thank you
oh, you where running out of memory
i think that was it
one last question please. can i access the prompt of a running instance on railway?
no you cant
ok, thank you
what is you usecase if i can ask?
i need to run an elasticsearch instance
so, i need access to the prompt to be able to configure it
that would need to be pre-configured before deploy, think of your service as a final cut of your code, not changing, and shouldnt change while on railway
yes, i understand what you mean. Thanks alot for your quick responses Brody.
no problem, happy coding
π
Thank you