R
Railwayβ€’16mo ago
krshnaprog

Increasing Worker Timeout

I want to increase worker timeout because it takes long to make some action, so I want to make it longer.. [1] [CRITICAL] WORKER TIMEOUT (pid:14) this is the error
30 Replies
Percy
Percyβ€’16mo ago
Project ID: N/A
Percy
Percyβ€’16mo ago
⚠️ experimental feature
krshnaprog
krshnaprogβ€’16mo ago
N/A
krshnaprog
krshnaprogβ€’16mo ago
Okay I understand that timeout is for workers, but how can actually I have to implement it? Is there any source that teaches this?
Brody
Brodyβ€’16mo ago
do you have a procfile or have you set a start command in the service settings?
krshnaprog
krshnaprogβ€’16mo ago
Let me check I have procfile with the content "web: gunicorn djangoauthapi.wsgi"
Brody
Brodyβ€’16mo ago
change to web: gunicorn --timeout 600 djangoauthapi.wsgi
krshnaprog
krshnaprogβ€’16mo ago
Easy πŸ˜„ Thank you Can I ask one more question here?
Brody
Brodyβ€’16mo ago
yes
krshnaprog
krshnaprogβ€’16mo ago
Okay, I have API for my mobile aplication, I am mobile dev and I do not know anything about backends but I followed Django tutorial and I created simple API, where from frontend I am sending some pictures and in the backend I have the function that handles it.. But sometime my frontend throws error because of no response from back, I think that increasing timeout will help this problem, because in the local deployment it works just fine.. Is above solution suffiecient for this purpose? I want to make timeout longer, like 5 minutes for exxample
Brody
Brodyβ€’16mo ago
do you see a worker timeout error in the railway logs at the time your frontend throws an error?
krshnaprog
krshnaprogβ€’16mo ago
yes.. [1] [CRITICAL] WORKER TIMEOUT (pid:14) [2023-04-11 04:44:13 +0000] [14] [INFO] Worker exiting (pid: 14) [2023-04-11 04:44:13 +0000] [14] [INFO] Worker exiting (pid: 14) [2023-04-11 04:44:13 +0000] [15] [INFO] Booting worker with pid: 15 [2023-04-11 04:44:13 +0000] [15] [INFO] Booting worker with pid: 15
Brody
Brodyβ€’16mo ago
and how long do you expect the backend to take to handle these images?
krshnaprog
krshnaprogβ€’16mo ago
I expect 10 seconds max, but I guess files is too large and takes time to get there.. 5 pictures I have..
Brody
Brodyβ€’16mo ago
well that timeout flag is time in seconds, so adjust to your needs
krshnaprog
krshnaprogβ€’16mo ago
Okay Brody thank you again, you are doing good job bless you!
Brody
Brodyβ€’16mo ago
thank you!
krshnaprog
krshnaprogβ€’16mo ago
I increased Timeout As you say --timeout 600 but still after 30 seconds it says the same thing with timer I set time and after 30 seconds it says [CRITICAL] WORKER TIMEOUT (pid:9)
Brody
Brodyβ€’16mo ago
that would seem like a code issue than
krshnaprog
krshnaprogβ€’16mo ago
Ahh Okay
Brody
Brodyβ€’16mo ago
but send me your current procfile in use in your project
krshnaprog
krshnaprogβ€’16mo ago
krshnaprog
krshnaprogβ€’16mo ago
I have print functions in my code that should print at least something in the logs but railway logs do not support I guess that loggings... Where Can i get more detailed logs..?
Brody
Brodyβ€’16mo ago
common issue, try settings PYTHONUNBUFFERED = 1 in the service settings
krshnaprog
krshnaprogβ€’16mo ago
where is the service settings? Ahh, in my Django project? settings.py
Brody
Brodyβ€’16mo ago
sorry, in the service variables
Brody
Brodyβ€’16mo ago
krshnaprog
krshnaprogβ€’16mo ago
Okay When Worker timeout it happening in railway? Is it possible to happen when I send some data from frontend to backend deployed in railway, and data is not completely sent, like too large info sent by user from frontend and it took too long and stopped sending data from frontend, Is it likely to have Worker timeout there?
Brody
Brodyβ€’16mo ago
its just sounding more and more like a code issue if im being honest