Need help with resolving deadlock

agepeder 271 Reputation points
2021-08-12T20:26:28.887+00:00

Hi,

I have started getting deadlocks in one of my batch processed and have difficulties figuring out how to resolve it.

Deadlock graph and table structure is attached to the post.
For a start I dont understand why a pocess can have an active lock on a page and at the same time request what seems like an additional lock on the same page which cannot be granted.

122837-image.png

I would be gratefull if anyone could point me in a direction :)

122883-ht-mainitemtable.txt
122838-rename-xml-to-xdl-before-opening-deadlock-modified.xml

Developer technologies | Transact-SQL
Developer technologies | Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
SQL Server | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 128.7K Reputation points MVP Volunteer Moderator
    2021-08-12T21:17:46.363+00:00

    I did not analyse that deadlock in detail. It looks quite complicated, as it both includes parallelism and locks.

    What I found is that there are two processes involved, spids 91 and 92. I see that both of them are Agent jobs step. One of them runs

    EXEC dbo.[Out_04.01.ItemLocation2] @db = N'webfi'
    

    The other process has webes instead of webfi.

    The obvious question is: why are there two jobs, and not one to run both things? (Maybe there is an equally obvious answer, but not knowing you system, it is not obvious to me.)

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.