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