R
Railway•8mo ago
mono

Sudden gunicorn errors. App unusable.

I get various timeout and memory errors. The strange thing is that the app was running like this before with another hoster and also the first days on Railway did not cause any problems. To explain, there are two running apps. A website and an app that converts/crops images. A calls B, B fetches the original image from A and returns an Optimized image. This should not take long, but now I have sporadic errors that make the page unusable. I have already tried to increase the timeout and the workers unsuccessfully.
No description
26 Replies
Percy
Percy•8mo ago
Project ID: 39aa0a37-73e0-4c64-86d2-8c772db5657f
mono
mono•8mo ago
39aa0a37-73e0-4c64-86d2-8c772db5657f and 36d5ac8d-ceaa-4b8d-9561-d38745c282b4
Brody
Brody•8mo ago
you're on the pro plan, correct?
mono
mono•8mo ago
yes
Brody
Brody•8mo ago
have you moved your project over to the team?
mono
mono•8mo ago
I have tried it in both environments. At the moment the website is in the Team and the cropper in the Hobby section
Brody
Brody•8mo ago
and what app is having issues?
mono
mono•8mo ago
Both show the same errors. Because everything has worked, think there is some sort of networking errors between the two. And that's results in the timeout on both ends.
Brody
Brody•8mo ago
are you using the private network?
mono
mono•8mo ago
no. public interface
Brody
Brody•8mo ago
are either services using a lot of memory?
mono
mono•8mo ago
I dont think so. The stats are locking ok and i never recognized something in the past.
mono
mono•8mo ago
this works but if you visit https://www.blacktre.es
BLACKTREES
Deine Digitalagentur in Leipzig und Köln/Bonn
Shop, Webapplikation oder Corporate Website. 🚀 BLACKTREES plant, managt und entwickelt dein Digitalprojekt! Remote und in Leipzig oder Köln/Bonn.
mono
mono•8mo ago
it will produce a lot of errors. So maybe concurrency is a problem. but just since yesterday
Brody
Brody•8mo ago
yeah this is seeming like a code / config issue, maybe you wanna move to multiple threaded workers for gunicorn instead?
mono
mono•8mo ago
just adding (--threads n) to the config?
Brody
Brody•8mo ago
sorry I'm not well versed in python development, you would significantly benefit from reading some articles about this topic
mono
mono•8mo ago
No problem, i try it gunicorn --timeout 120 --workers=4 --threads=4 --log-level=debug --bind 0.0.0.0:$PORT application:app It works. Lightning fast 🙂 I know that workers need more memory and process management costs extra. I still find the result strange. Eight workers as before should be more than enough and then also the fact that it just stopped working.
Brody
Brody•8mo ago
before you where using a single sync worker?
mono
mono•8mo ago
startCommand = "pipenv run gunicorn --workers=2 --bind 0.0.0.0:$PORT application:app" That is what I had, and it has worked. After the first errors occurred, I tried increasing timeout and workers.
Brody
Brody•8mo ago
(by default gunicorn binds to exactly what you have specified in the bind flag)
mono
mono•8mo ago
What do you mean? There is no problem with the bind. I mean: The request and the scaling should only need a second, or may be two. So even if the app can't do this with 2 workers in parallel, they should still fit in the timeout window one after the other.
Brody
Brody•8mo ago
you're right, there's no problem with the bind, it's just redundant since that is the default bind address
mono
mono•8mo ago
ok, nice that it is running now. Even if it is a bit frustrating not to be able to understand exactly what the problem was. And thanks for your help!
Brody
Brody•8mo ago
that's python / gunicorn for you