You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executed in a highly concurrent environment, it’s possible that the raise will be triggered.
If that happens inside of non-transactional advisory_lock, then it’s possible that when you try to release your lock, you will be given a different connection than was used to obtain that lock, e.g.
In that case, you can end up with a lock that is never released, or more specifically, released by the PG server when the que process exits and the connection is disconnected.
This is a problem for us, because we use advisory locks to synchronize access to specific DB records, which causes some jobs to be stuck until the que process is restarted.
I've done some digging and I'm planning to submit a PR with a fix proposal shortly 🙂
The text was updated successfully, but these errors were encountered:
Hey, we run into a problem when combining
que
,active_record
and PGadvisory_lock
in a highly concurrent environment.The active database connection is being released back to the pool immediately when a que job is scheduled from within another que job.
Consider the following sample jobs:
When executed in a highly concurrent environment, it’s possible that the
raise
will be triggered.If that happens inside of non-transactional
advisory_lock
, then it’s possible that when you try to release your lock, you will be given a different connection than was used to obtain that lock, e.g.In that case, you can end up with a lock that is never released, or more specifically, released by the PG server when the que process exits and the connection is disconnected.
This is a problem for us, because we use advisory locks to synchronize access to specific DB records, which causes some jobs to be stuck until the que process is restarted.
I've done some digging and I'm planning to submit a PR with a fix proposal shortly 🙂
The text was updated successfully, but these errors were encountered: