Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deadlock due to table level exclusive lock

16 views
Skip to first unread message

Arun Srinivasan

unread,
Apr 22, 2008, 4:58:09 PM4/22/08
to
Please correct me if I am wrong
1. no 2 processes can have exclusive lock on same object (by object,
same row or same table)
2. on deadlock incident between 2 processes only one of them will be
cancelled by db2 to let the other finish.

Now, can there be an instance where 2 processes have 'EXCLUSIVE LOCK'
on same table, and are waiting on the same 'EXCLUSIVE LOCK' held by
the other agent to be relinquished. They both are cancelled by db2
using the 911 sqlstate.
It has been continuously happening to me, and it perplexes me.

This happenes because I use the 'lock table <table_name> in exclusive
mode' statement in a stored procedure, and I call that SP in three
applications at the same instance. Can this happen? I also got event
monitor output, and am analysing the same.

People write my 'problem ticket' off, saying this is a normal deadlock
issue. But I don't think so. Please help.

Serge Rielau

unread,
Apr 22, 2008, 5:33:39 PM4/22/08
to
> People write my 'problem ticket' off, saying this is a normal deadlock
> issue. But I don't think so. Please help.
People? If you are talking about support, are you aware that you can
escalate to the duty manager if you don't like the answer you're getting?

What you describe should not happen. It is more likely that your
information is incomplete, than that there is a defect.. But on enever
knows.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Knut Stolze

unread,
Apr 23, 2008, 3:58:16 AM4/23/08
to
Arun Srinivasan wrote:

> Please correct me if I am wrong
> 1. no 2 processes can have exclusive lock on same object (by object,
> same row or same table)
> 2. on deadlock incident between 2 processes only one of them will be
> cancelled by db2 to let the other finish.
>
> Now, can there be an instance where 2 processes have 'EXCLUSIVE LOCK'
> on same table, and are waiting on the same 'EXCLUSIVE LOCK' held by
> the other agent to be relinquished. They both are cancelled by db2
> using the 911 sqlstate.
> It has been continuously happening to me, and it perplexes me.
>
> This happenes because I use the 'lock table <table_name> in exclusive
> mode' statement in a stored procedure, and I call that SP in three
> applications at the same instance. Can this happen? I also got event
> monitor output, and am analysing the same.

From this brief description we should be able to answer your question?


--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

Ian

unread,
Apr 24, 2008, 9:34:19 AM4/24/08
to
Arun Srinivasan wrote:
> Please correct me if I am wrong
> 1. no 2 processes can have exclusive lock on same object (by object,
> same row or same table)
> 2. on deadlock incident between 2 processes only one of them will be
> cancelled by db2 to let the other finish.
>
> Now, can there be an instance where 2 processes have 'EXCLUSIVE LOCK'
> on same table, and are waiting on the same 'EXCLUSIVE LOCK' held by
> the other agent to be relinquished. They both are cancelled by db2
> using the 911 sqlstate.
> It has been continuously happening to me, and it perplexes me.

What reason code is DB2 returning to each agent?

I don't think it's possible to get SQL0911N RC=2 (deadlock) from both
agents.

However, if you are getting SQL0911N RC=68 (lock timeout) from one
agent and SQL0911N RC=2 (deadlock) from the other agent, this could
happen - theoretically - if LOCKTIMEOUT is set to the same value as
DLCHKTIME. I think it would be highly unlikely (both agents would
have to request the other's locks within microseconds of each other).

0 new messages