Connection info published on relation before pg_hba.conf updated/reloaded

Bug #1577544 reported by Tim Van Steenburgh
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
PostgreSQL Charm
Fix Released
Critical
Stuart Bishop

Bug Description

Using charm cs:~tribaal/trusty/postgresql-built-0

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-queue", database "review-queue", SSL off

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://github.com/tvansteenburgh/review-queue-charm/blob/master/reactive/review_queue.py#L157

And the postgres interface I'm using is what you see here: https://github.com/bcsaller/juju-relation-pgsql/pull/3/files

Tags: oil
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :
description: updated
Revision history for this message
Stuart Bishop (stub) wrote :

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.

Changed in postgresql-charm:
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
Greg Lutostanski (lutostag) wrote :

Any outlook for this one?

tags: added: oil
Revision history for this message
Stuart Bishop (stub) wrote :

I found and fixed the race, and just need to make a release.

Changed in postgresql-charm:
assignee: nobody → Stuart Bishop (stub)
status: Triaged → In Progress
status: In Progress → Fix Committed
Stuart Bishop (stub)
Changed in postgresql-charm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.