Subject Re: [firebird-support] Re: lock conflict on no wait transaction - finding the user
Author Thomas Steinmaurer
> --- In firebird-support@yahoogroups.com, Thomas Steinmaurer<ts@...> wrote:
>>
>>> Is there something I can do to find out which user is locking a particular
>>> record in a database? If I can use the transaction number to lookup the
>>> user, then I may be able to simply ask that user to re-start his machine?
>>> The server is running Firebird Superserver 2.1.4 on Windows.
>>>
>>> I am trying to delete some records in a table but the following message is
>>> displayed:
>>>
>>> "lock conflict on no wait transaction deadlock update conflicts with
>>> concurrent update concurrent transaction number is 7850179"
>>
>> If your database has an ODS of at least 11.1, then you can do:
>>
>> select
>> a.*
>> , t.*
>> from
>> mon$transactions t join mon$attachments a on (t.mon$attachment_id =
>> a.mon$attachment_id)
>> where
>> mon$transaction_id = 7850179
>>
>>
>> This will give the transaction and attachment information for this
>> particular transaction id.
>>
>
> I am a bit confused. My application gives me a deadlock error and its transaction ID. That is of not much use imo, I already know it is my process which cannot access the record.
> What I would like to know is which process/attachment holds the lock which stops me from working on that record. How can I get the transaction ID, or any other identifying data, of the other process?

When you get:

"lock conflict on no wait transaction deadlock update conflicts with
concurrent update concurrent transaction number is 7850179"

Perhaps I get it wrong, but transaction ID 7850179 is already the
offending one, which blocks your transaction context to perform the
operation. So, with the above monitoring table query, you already get
all available information of the blocking process/attachment. You then
might like to cut it down at statement level, by e.g.:

select * from mon$statements where mon$transaction_id = 7850179

and inspect what DML statements are running in context of this transaction.


--
With regards,
Thomas Steinmaurer (^TS^)
Firebird Technology Evangelist

http://www.upscene.com/
http://www.firebirdsql.org/en/firebird-foundation/