R
Railway13mo ago
fedez101

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
Percy
Percy13mo ago
Project ID: f200b0e7-24e4-4acc-8c43-179d952e64a9
fedez101
fedez10113mo ago
f200b0e7-24e4-4acc-8c43-179d952e64a9
Brody
Brody13mo ago
what's your current start command?
fedez101
fedez10113mo ago
Im using "Gunicorn -b 0.0.0.0:5000 app:app --timeout 600", and it still fails almost immediately
Brody
Brody13mo ago
show me the deploy logs please
fedez101
fedez10113mo ago
fedez101
fedez10113mo ago
here are the deploy logs
Brody
Brody13mo ago
this has nothing to do with gunicorn?
fedez101
fedez10113mo ago
no these are warnings, the server should start even with this message
Brody
Brody13mo ago
well its obviously not starting lol how big is your model file
fedez101
fedez10113mo ago
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
Brody
Brody13mo ago
i dont see any gunicorn errors in your logs so this is likely a code issue, with an error you arent logging
fedez101
fedez10113mo ago
the same setup works fine when i run it on linux with gunicorn without containerizing it ie.
Brody
Brody13mo ago
that does not mean its a railway problem theres not much i can do to help you unless i can see some error logs
fedez101
fedez10113mo ago
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
Brody
Brody13mo ago
^
fedez101
fedez10113mo ago
ok, i'll see how i can get some. Thanks alot. i just upgraded to hobby and tried it, and it worked... thank you
Brody
Brody13mo ago
oh, you where running out of memory
fedez101
fedez10113mo ago
i think that was it one last question please. can i access the prompt of a running instance on railway?
Brody
Brody13mo ago
no you cant
fedez101
fedez10113mo ago
ok, thank you
Brody
Brody13mo ago
what is you usecase if i can ask?
fedez101
fedez10113mo ago
i need to run an elasticsearch instance so, i need access to the prompt to be able to configure it
Brody
Brody13mo ago
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
fedez101
fedez10113mo ago
yes, i understand what you mean. Thanks alot for your quick responses Brody.
Brody
Brody13mo ago
no problem, happy coding
fedez101
fedez10113mo ago
🙏 Thank you