with_advisory_lock
with_advisory_lock copied to clipboard
Doesn't seem to work on CrunchyData CrunchyBridge, leaves locks open, not sure why
We just migrated from pg 15 on Heroku to CrunchyData CrunchyBridge and started seeing lots of "WARNING: you don't own a lock of type ExclusiveLock"
per https://github.com/bensheldon/good_job/issues/388 "The warning is output by the database adapter. It means that the current database connection (thread) is trying to unlock an Advisory Lock that does not exist."
Turning off all calls to with_advisory_lock (via feature flag) made the warnings go away and restored healthy behavior.
I've talked to CrunchyData CrunchyBridge and we've compared the database sessions and can't figure out why they are behaving differently. Perhaps idle_session_timeout=0 and they are culled faster on CrunchyData CrunchyBridge? In any case, we've had to disable this gem for now and thought it worth sharing for the community.
Hi,
Do the app has multi database setup ?
I should release the new version that is aware of such setup.
Thanks for following up. I forgot I had opened this.
The error ended up us being on pgbouncer in transaction mode (unintentionally)
To properly use pgbouncer, we need a direct connection for migrations and for advisory locks.
In a multi database system, that means adding a special connection pool for direct connections and configure a special connection class to use it And then only use that for advisory locks
@bf4 , can you try master , i will release the new version this week, i'm just trying to clean up closure_tree from legacy baggage.