"Unknown host" error with database connection

30 views
Skip to first unread message

John Bryant

unread,
Dec 1, 2022, 3:00:28 AM12/1/22
to QGIS Australia User Group
Hi all, I'm running into an issue that's annoying for users, but I can't seem to find a good solution.

When they connect to their PostGIS database (hosted in AWS RDS), mostly it works perfectly, but sometimes they get hit with a series of "Unknown host" dialogs, asking them for a username and password (already part of their auth config so shouldn't need to provide them again).

They can just dismiss the dialog and the data comes through fine, but ideally we could avoid the dialogs altogether, they give the impression of flakiness.

It might be something to do with a slight delay in resolving the address but I'm not sure.

image.png

Any ideas?

Thanks!
John

Bill Williamson

unread,
Dec 1, 2022, 3:15:08 AM12/1/22
to australian-qg...@googlegroups.com
Hey John, 
I've never been an AWS RDS admin but I believe it can idle down. Not sure the postgres incarnation on RDS was considered for map users. If there is an admin setting in AWS to be "always on" maybe that's worth looking into. 
Postgres itself can also be configured to have a max no of connections. What the default on RDS is, who knows. But possibly you can configure that from your client without having to be RDS admin. 
Also your mileage may vary with "SSL prefer" on the QGIS side. 

Bill

--
You received this message because you are subscribed to the Google Groups "QGIS Australia User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to australian-qgis-use...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/australian-qgis-user-group/CAHY5hn9Ufkx5GMxMsOtEnNTrhdQVYPhEd3AJdPvfCqKvvr1Zrg%40mail.gmail.com.

John Bryant

unread,
Dec 1, 2022, 5:01:57 AM12/1/22
to australian-qg...@googlegroups.com
Thanks for those tips Bill.

Good point re: whether RDS postgres is set up for map users. The postgis extension is available so there's that, but I'd be very curious to hear about others' experiences with this setup. We've generally had a good experience with it, but things can always be better.

Max connections aren't a problem in this case, currently configured well above what we've maxed out at.

I'll have a play with the different SSL options on the QGIS side and see what I can get out of that...

Would love to suppress these annoying dialogues!

Cheers!
John

 

Nathan Woodrow

unread,
Dec 1, 2022, 5:33:34 AM12/1/22
to australian-qg...@googlegroups.com
This is sounding like a possible connection timeout issue and QGIS not handling it very well.  

I run PostGIS on RDS in production and haven't seen these kinds of issues, however, I'm not connecting directly via QGIS.
 
What region is the RDS?

- Nathan

John Bryant

unread,
Dec 1, 2022, 7:49:42 PM12/1/22
to australian-qg...@googlegroups.com
Thanks Nathan,

It's in the Asia Pacific (Sydney) region, and we're mostly connecting from WA. Generally the direct connection is working really well, these unknown host issues are the main annoyance, especially for novice users.

Timeout does seem like a possibility. But mine is set to 60000ms which is quite a long time and it still happens occasionally.

It seems to get triggered more frequently when I wake my computer up from being suspended, but I haven't yet found a reliable way to trigger it so it's a bit hard to pin down.

Bill Williamson

unread,
Dec 2, 2022, 1:08:26 AM12/2/22
to australian-qg...@googlegroups.com
I do recall now a problem with RDS where if you left QGIS in the background for more than half an hour and then went to do something,  it would be unresponsive for up to 30 seconds.
See if that reproduces your issue.

John Bryant

unread,
Dec 2, 2022, 2:45:43 AM12/2/22
to australian-qg...@googlegroups.com
Thanks Bill, I'll give that a shot. Would be nice if that were a reliable way to trigger the message, then I might be able to troubleshoot a bit better!

John Bryant

unread,
Dec 4, 2022, 8:38:34 PM12/4/22
to australian-qg...@googlegroups.com
I can confirm that putting the computer to sleep and returning to a QGIS project with PostGIS layers after a few hours seems to reliably trigger the "Unknown host" dialog.

I tested it out with two PostGIS databases, one on RDS and one on a Linux server, and the same problem occurs in both cases, so I don't think it's specifically related to RDS.

Running the Debugging/Development Tools doesn't turn up any error messages and the data comes through fine, I don't think the message is related to any actual problem but it's a bit disconcerting for new users...
Reply all
Reply to author
Forward
0 new messages