Skip to content

Doesn't seem to work on CrunchyData CrunchyBridge, leaves locks open, not sure why #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bf4 opened this issue Feb 17, 2025 · 2 comments

Comments

@bf4
Copy link

bf4 commented Feb 17, 2025

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 bensheldon/good_job#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.

@seuros
Copy link
Member

seuros commented Mar 7, 2025

Hi,

Do the app has multi database setup ?

I should release the new version that is aware of such setup.

@bf4
Copy link
Author

bf4 commented Mar 7, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants