#App periodically loses connection to postgres

33 messages · Page 1 of 1 (latest)

serene kindle
#

Every few days my web app running in production loses access to the postgres DB I have also deployed via Railway. I see a "connection timeout" error from the client logs, and nothing gets logged to the server according to the Railway observability tab. The only way I have been able to fix it is triggering a re-deployment which presumably rolls the Kubernetes pods. Any ideas?

vagrant falconBOT
#

Project ID: 80d4d55f-409c-4c75-9ab3-61d3cefe2e46

serene kindle
eternal tusk
#

What kind of app are you running? Are you using private networking?

serene kindle
#

It's a bun app running JS on server and client. Using the postgres library (https://github.com/porsager/postgres) to connect to the DB. Not doing anything special with networking that I know of

eternal tusk
#

Okay, bummer. Unfortunately I can't provide much help, but while you wait on people that can help, could you post the error you're receiving? Those are usually very valuable pieces of info :)

hidden crater
#

I've noticed the same thing.

wary gust
#

dan, are you using a pooled connection?

#

@hidden crater - if you arent using bun or the postgres library, please open your own help thread

hidden crater
wary gust
#

are you using the postgres library in code?

#

not quite asking about the database you have deployed

hidden crater
wary gust
#

what kind of app do you have

hidden crater
#

nodejs with pg and sequelize

#

But sorry, I didn't mean to highjack the issue here 😊
And I cannot confirm that I keep having this issue till the logs are back.

wary gust
#

are you using a pool?

#

yeah the logging issues really hampers debugging

hidden crater
wary gust
#

show the error please

hidden crater
#

I don’t have logs 😊

wary gust
#

haha yeah but I'm sure there's logs from a previous (but same) error right?

hidden crater
#

Need to check but I left office now. Let’s see how the logging resolution goes and when I’ll go back to my machine I’ll search and post here if I find anything

serene kindle
wary gust
#

can you set the pool minimum to 0 and see how that goes?

serene kindle
#

pool minimum? Do you mean max number of connections?

wary gust
#

i mean the minimum number of connections, aka pool minimum, set it to zero

serene kindle
wary gust
#

not being able to set the minimum to zero causes issues when running in a docker environment

serene kindle
#

I'm gonna try setting idle_timeout, I wonder if the max connections (default 10) is getting reached and the railway pods are running out of memory

wary gust
#

railway does not use k8s

#

the postgres databases have 8gb of ram available, same as your plan allows for

serene kindle
#

Thanks for the help!