tsql - Why SELECT can have SIU lock (SQL Server 2012)? -
today troubleshooting deadlock case , discovered quite strange case (at least seemed strange me). had 2 concurrent statements (update , select) , led deadlock scenario. no question there. below deadlock graph depicts case:

what bothers me type of lock select holds. why siu (share intern update), not s (shared) or is (intent shared) lock? 
i found post on msdn forum, explains quite similar case:
profiler shows current cumulative lock sessions. after exported deadlock event xdl-file , opened in text editor found process selects data has s lock , process updates data has iu lock (and wants ix lock). , resource siu-locked (s+iu).
for me sounds (and doesn't make sense):
select has siu lock, because other session has intent update
can anybody, please, explain me why select holds siu lock?
update: select statement autogenerated ef 6.1.2; update statement stored procedure.
i think turn out there dml executing under same transaction. know stated not case don't see how selects can take write locks.
attach profiler , capture statements , transaction operations (the tm events). maybe you'll find more going on in same session , transaction expect.
submitting guess answers because seems quite solution.
Comments
Post a Comment