Sporadic : Error: pool timed out while waiting for an open connection
I keep getting this every few deploys, seems like the connection to the DB is very unreliable.
15 Replies
Project ID:
b58d71f6-d2f6-4c69-ba03-9b155d79a099
b58d71f6-d2f6-4c69-ba03-9b155d79a099
It seems to get fixed if I redeploy the same build, restarting isn't enough
at what point in your apps lifecycle do you get this error?
After deployment , trying to connect to the DB on startup.
It happens 1:5 deploys or less.
this is postgres right?
Yes
show me the code that connects to the database?
well you already have a timeout of 5 seconds, that's what i was gonna suggest you add, so the next suggestion would be to add a retry mechanism
try implementing a retry mechanism
it repeats and on restart is the same, only redeploy sorts it
try implementing a retry mechanism in code
i pass my docker the DATABSE_URL, do I need to explicitly expose the database PORT?
if a restart doesn't help, not seeing why a code based retry will be different.
they are completely different things, railways restart mechanism restarts the whole docker container
let me know how this goes!