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 possibleSolution:Jump to solution
have a look at this please https://docs.railway.app/reference/private-networking#workaround-for-alpine-based-images
35 Replies
Project ID:
1a73e8f4-a61d-4a67-9bd7-3539b677698b
1a73e8f4-a61d-4a67-9bd7-3539b677698b
are you building with nixpacks?
No, docker
are you using an alpine based image?
Yes,
eclipse-temurin:17-jdk-alpine
to be preciseSolution
have a look at this please https://docs.railway.app/reference/private-networking#workaround-for-alpine-based-images
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
cool, keep me posted if you run into any more issues
Will do
No dice, I still get timeouts
at what point in your apps lifecyle are you making this request that results in a timeout?
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?
its more like 2 seconds but yes
Hmm, it does so for significantly longer (well over a minute)
Maybe i didnt set the variable correctly?
Hmm, no it looks correct
private network total initialization times dont exceed 3.7 seconds max
average being 2 seconds
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
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
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
hopefully!
just a quick question. Is there a difference between choosing
servicename.railway.internal
and the plain (you can also call me) servicename
?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=ipOkay, good to know!
No luck. Connection timed out
Just making sure, this is how the Alpine env var is supposed to look like, right?
well i wish i knew what the problem was, all i know is that it isnt railway
ITS APLINE
OHMYGOD
omfg
how did that happen?
mobile ui i guess
you didnt copy / paste?
I should stop manually copying variables
This looks very promising, it didn't even crash on startup
Oh why am i so incredibly stupid
hey i didnt catch it either when you asked me
The only reason i caught it is because i misspelled aplin alpine in my message and i thought i'd give it another look
finally solved!
Yes, I assume so! I'll mark as solved on the link you sent a while back
Thanks for your help Brody, and sorry for wasting your time over a spelling error
haha no worries