Connection info published on relation before pg_hba.conf updated/reloaded
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PostgreSQL Charm |
Fix Released
|
Critical
|
Stuart Bishop |
Bug Description
Using charm cs:~tribaal/
My charm received all postgres connection info (including seeing its unit in 'allowed-units') from a db-relation-changed hook. Upon attempting to connect to postgres, a pg_hba rejection error occurred. (I can see the error in the app logs on my charm unit). If I ssh to the postgres unit immediately after this, I can see that pg_hba.conf does not include any rows for my unit.
If I leave the deployment untouched, the pg_hba.conf will eventually be updated, and my charm will connect successfully.
The attached log file demonstrates this. The 'review-queue' is my charm. Line 4286 is where review-queue first receives all relation data it needs to connect. Line 4289 is where the review-queue service fails to start. Error from the review-queue app log:
FATAL: pg_hba.conf rejects connection for host "10.0.4.58", user "juju_review-
Fast-forward in the log to line 4398 and we see the pg_hba.conf being updated. Subsequently, on line 4425, the review-queue successfully starts.
In case it helps, my charm's handler is here: https:/
And the postgres interface I'm using is what you see here: https:/
description: | updated |
Changed in postgresql-charm: | |
status: | Fix Committed → Fix Released |
I've seen this report from others too.
The charm handler and PostgreSQL interface should be irrelevant; the PostgreSQL charm should not be publishing connection details before they are valid. I think this failure must be due to a race in the PostgreSQL charm.