About postgresql pg_advisory_xact_lock use!!!!

Started by andy yeover 6 years ago2 messagesbugs
Jump to latest
#1andy ye
andy.ye@gtssz.net

Hello All:

When I use the pg_advisory_xact_lock provided by postgresql, I often see that the lock part cannot be released and the service is blocked. I would like to know what situations might cause this behavior. Thank you!!!

Your’s Andy

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: andy ye (#1)
Re: About postgresql pg_advisory_xact_lock use!!!!

andy ye <andy.ye@gtssz.net> writes:

When I use the pg_advisory_xact_lock provided by postgresql, I often see that the lock part cannot be released and the service is blocked. I would like to know what situations might cause this behavior. Thank you!!!

I'd say the odds are just about 100% that you're not closing the
transaction. Transaction-scope advisory locks are managed exactly
like any ordinary lock in the system, so if we had a bug that allowed
them to not be released at transaction end, there would be obvious
consequences everywhere.

regards, tom lane