Gunicorn worker timeouts
coderjoshdk
TRIALOP

a year ago

I have a django service that is ran with gunicorn works. For some reason, my more expensive DB requests are timing out and crashing. The log shows up as:

[2024-10-27 15:11:32 +0000] [30] [CRITICAL] WORKER TIMEOUT (pid:30356)
[2024-10-27 15:11:33 +0000] [30] [ERROR] Worker (pid:30356) was sent SIGKILL! Perhaps out of memory?
[2024-10-27 15:11:34 +0000] [30408] [INFO] Booting worker with pid: 30408

I also attached the resource useage. It shouldn't be memory nor vcpu since there is much more left. Unless for some reason gunicorn doesn't recognize that it can tap into more memory for a given worker? Is that possible? I am not 100% sure what might be going on. Then again, it might just be a timeout and not memory related. I still find it strange though that the memory consumption for django + workers is so steady with no change in levels. Idk.
project id: 1b326884-0c17-43ed-9b52-f443662e8f50

24 Replies

coderjoshdk
TRIALOP

a year ago

hmmmm actually, it might just be timing out and I need to up the timeout limit. That is fine. But I do still wonder about the memory being so steady. And also while the query is expensive, it shouldn't be that expensive. Strange for sure. <:hmmmm:419873765732777984>
Oh well. I shall figure it out


coderjoshdk
TRIALOP

a year ago

Yea, the default timeout is 30s. Idk why but I thought it was 60s. I will try to bump it up and see if that fixes my issue. Likely it will. But that is upsetting that this query is taking that long. Because I look at the logs of postgres, and it has 0 complaints. So it must really be a timeout and not to do with memory.


coderjoshdk
TRIALOP

a year ago

Lol this is such a sad day. Yea, the query is just too slow. <:cry_gil:795020958352146443> Ok. No issues. Thanks


coderjoshdk
TRIALOP

a year ago

Time to add a loader indicator on the page. smh. Clearly none of the users actually use this query since not a single complaint has come in .. but <:shrug:747680403778699304>


a year ago

database on railway and you're connecting to it via the private network, right?


coderjoshdk
TRIALOP

a year ago

Yea


coderjoshdk
TRIALOP

a year ago

Wait … maybe it isn't ???? Hold up I gotta go check something <:scared:795021402331807755>


coderjoshdk
TRIALOP

a year ago

Alright yea, it was calling PGHOST and not PGPRIVATEHOST. Switiching it now and deploying. Lets see if that makes things better. I guess yea, I have not touched this project in quite a bit of time …. oops


a year ago

these things happen


coderjoshdk
TRIALOP

a year ago

<:cry_gil:795020958352146443> time to debug

1300131166912909300


coderjoshdk
TRIALOP

a year ago

(also the new old builder is much faster lol. Thanks)


coderjoshdk
TRIALOP

a year ago

Ah. I think it is because the private port is different than the public one. Any reason for this?


a year ago

The reason for the private port being different from the public port?


coderjoshdk
TRIALOP

a year ago

No actually I can intuit the reason


coderjoshdk
TRIALOP

a year ago

But there is no var ref for it? Is this accurate. I can't seem to find one?


a year ago

exposing 5432 for everyone's database isn't scalable haha


coderjoshdk
TRIALOP

a year ago

No RAILWAY_PRIVATE_TCP_PROXY_PORT


a year ago

RAILWAY_TCP_APPLICATION_PORT


coderjoshdk
TRIALOP

a year ago

Ah yep, just found that


a year ago

as long as you have a TCP proxy on the database, that is what you want to use for the internal port


coderjoshdk
TRIALOP

a year ago

Yea. And it does make sense as a name once I know about it. I was just looking for the miror of the other var name with PRIVATE in it.


a year ago

that's fair


coderjoshdk
TRIALOP

a year ago

Eh. Honestly changing it to be through the private proxy didn't really change things. But either way, the original problem was a skill issue and so this thread can be marked solved.


a year ago

sounds good to me


Loading...