Concurrent Inserts into a CCI can Deadlock Under Memory Pressure - by Joe Obbish

Status : 


Sign in
to vote
ID 3142915 Comments
Status Active Workarounds
Type Bug Repros 4
Opened 10/22/2017 8:47:55 AM
Access Restriction Public


Concurrent inserts into a CCI can deadlock on a server with memory pressure.
If I kick off 3 sessions at the same time only the first one is able to insert rows.
Sessions 2 and 3 have a wait type of LCK_M_IX.
Once session 1 inserts all of its rows into a delta store it rolls them back.
After the rollback is complete a deadlock is reported to the client for session 1:

Msg 1205, Level 13, State 134, Line 1
Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Sessions 2 and 3 are able to insert their rows concurrently into the CCI without issues after the session 1 is killed.
Sign in to post a comment.
Posted by Microsoft on 11/17/2017 at 10:03 AM
Thanks for your report. We are looking into this situation. I will reply back when we have more insight to share.
Posted by Lonny Niederstadt on 10/22/2017 at 3:00 PM
I was able to reproduce the deadlock with Joe's setup. On a 16 vcpu VM, two separate tests with 12 concurrent insert queries produced only one deadlock. With query concurrency higher than vcpu count (17 queries or more on this VM), probability of a deadlock seemed higher.