Internal network timeout

I'm running a Discord4J bot on Railway, and I have also deployed my Postgres database to railway. When i use the internet connection URL, I have no issues connecting from app to db, but when I enter the internal networking url, it works for a bit, and then starts timing out (relevant error: Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.) What could be causing this, and how do i fix it? It's not a very pressing issue: I can still use the internet url, but i'd rather use the internal network if possible
35 Replies
Percy
Percy8mo ago
Project ID: 1a73e8f4-a61d-4a67-9bd7-3539b677698b
Lelebees
Lelebees8mo ago
1a73e8f4-a61d-4a67-9bd7-3539b677698b
Brody
Brody8mo ago
are you building with nixpacks?
Lelebees
Lelebees8mo ago
No, docker
Brody
Brody8mo ago
are you using an alpine based image?
Lelebees
Lelebees8mo ago
Yes, eclipse-temurin:17-jdk-alpine to be precise
Lelebees
Lelebees8mo ago
Having her redeploy now, lets see if it works Well, she booted. Gonna keep her running to verify that it works, although it seems like it should
Brody
Brody8mo ago
cool, keep me posted if you run into any more issues
Lelebees
Lelebees8mo ago
Will do No dice, I still get timeouts
Brody
Brody8mo ago
at what point in your apps lifecyle are you making this request that results in a timeout?
Lelebees
Lelebees8mo ago
The app is getting data from the db every minute, and every 5 minutes. It most certainly happens on the 1-minute schedule, but I cannot tell if the 5-minute one has the same issue It also times out when booting, but that should be because of the 100 ms internal network bootup time, no?
Brody
Brody8mo ago
its more like 2 seconds but yes
Lelebees
Lelebees8mo ago
Hmm, it does so for significantly longer (well over a minute) Maybe i didnt set the variable correctly? Hmm, no it looks correct
Brody
Brody8mo ago
private network total initialization times dont exceed 3.7 seconds max average being 2 seconds
Lelebees
Lelebees8mo ago
Interesting. You reckon it being an ipv6 connection might be what's throwing a spanner in the works? Oh, it could be worthwhile to try updating the dependencies i'm using to manage and connect to the database. Will get back to you on that in like, 12 hours
Brody
Brody8mo ago
there is a lot of stuff that doesn’t play nicely with ipv6, so yeah that could be an issue. ill run a cron job that attempts 12 database connections every minute and get back to you on that too ran the 12 tests every minute all night, no errors
Lelebees
Lelebees8mo ago
Well, good news, it no longer takes a minute to connect to the internal network on startup (after i updated spring to 3.1.5 (from 3.1.2) and postgres driver to 42.6.0 (from 42.5.4)) Fingers crossed that that was it
Brody
Brody8mo ago
hopefully!
Lelebees
Lelebees8mo ago
just a quick question. Is there a difference between choosing servicename.railway.internal and the plain (you can also call me) servicename?
Brody
Brody8mo ago
no they would return the exact same dns results i have seen some software not place nicely with servicename.railway.internal and only work with servicename or vice versa, but that isnt an issue with railway https://utilities.up.railway.app/dns-lookup?value=hello-world.railway.internal&type=ip https://utilities.up.railway.app/dns-lookup?value=hello-world&type=ip
Lelebees
Lelebees8mo ago
Okay, good to know! No luck. Connection timed out
Lelebees
Lelebees8mo ago
Just making sure, this is how the Alpine env var is supposed to look like, right?
No description
Brody
Brody8mo ago
well i wish i knew what the problem was, all i know is that it isnt railway
Lelebees
Lelebees8mo ago
ITS APLINE OHMYGOD
Brody
Brody8mo ago
omfg how did that happen?
Lelebees
Lelebees8mo ago
mobile ui i guess
Brody
Brody8mo ago
you didnt copy / paste?
Lelebees
Lelebees8mo ago
I should stop manually copying variables This looks very promising, it didn't even crash on startup Oh why am i so incredibly stupid
Brody
Brody8mo ago
hey i didnt catch it either when you asked me
Lelebees
Lelebees8mo ago
The only reason i caught it is because i misspelled aplin alpine in my message and i thought i'd give it another look
Brody
Brody8mo ago
finally solved!
Lelebees
Lelebees8mo ago
Yes, I assume so! I'll mark as solved on the link you sent a while back
Lelebees
Lelebees8mo ago
Thanks for your help Brody, and sorry for wasting your time over a spelling error
Brody
Brody8mo ago
haha no worries