Consider the following scenario:
- In Microsoft SQL Server 2005 or in Microsoft SQL Server 2008, you set up multiple query notification subscriptions on some tables.
- You update these tables.
- The requests for the query notification subscriptions are fired concurrently.
In this scenario, deadlocks may occur on the query notification system tables (for example, a system table with a name that resembles sys.query_notification_xxxxxx). Additionally, the following deadlock graph is logged in the SQL Server error log file:
waiter id=process7f8dc48 mode=U requestType=wait,
waiter-list,
owner id=process873ce38 mode=U,
owner-list,
keylock hobtid=72057594049462272 dbid=5 objectname=<Database>.sys.query_notification_626101271 indexname=cidx id=lock178dd6c0
mode=U associatedObjectId=72057594049462272,
waiter id=process873ce38 mode=U requestType=wait,
waiter-list,
owner id=process7f8dc48 mode=U,
owner-list,
keylock hobtid=72057594049462272 dbid=5 objectname=<Database>.sys.query_notification_626101271 indexname=cidx id=lock176848c0
mode=U associatedObjectId=72057594049462272,
resource-list,
<Query>,
inputbuf,
<Query>,
frame procname=adhoc line=1 sqlhandle=0x020000009f5c4302918e8370f6d9bd71045a53f75b8056b3,
executionStack,
process id=process873ce38 taskpriority=0 logused=0 waitresource=KEY: 5:72057594049462272 (0e0086ec58d5) waittime=4984 ownerId=574444809 transactionname=CQueryScan::BeginNotifXact lasttranstarted=<Date><Time> XDES=0x732047f8 lockMode=U schedulerid=7 kpid=8068 status=suspended spid=133 sbid=0 ecid=0 priority=0 transcount=0 lastbatchstarted=<Date><Time> lastbatchcompleted=<Date><Time> clientapp=.Net SqlClient Data Provider hostname=<hostname> hostpid=1824 loginname=<loginname> isolationlevel=read committed (2) xactid=574444808 currentdb=5 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056,
<Query>,
inputbuf,
<Query>,
frame procname=adhoc line=1 sqlhandle=0x020000009f5c4302918e8370f6d9bd71045a53f75b8056b3,
executionStack,
process id=process7f8dc48 taskpriority=0 logused=0 waitresource=KEY: 5:72057594049462272 (0d006843edc7) waittime=4984 ownerId=574444769 transactionname=CQueryScan::BeginNotifXact lasttranstarted=<Date><Time> XDES=0x6adc9528 lockMode=U schedulerid=5 kpid=676 status=suspended spid=293 sbid=0 ecid=0 priority=0 transcount=0 lastbatchstarted=<Date><Time> lastbatchcompleted=<Date><Time> clientapp=.Net SqlClient Data Provider hostname=<hostname>110 hostpid=1272 loginname=<loginname> isolationlevel=read committed (2) xactid=574444768 currentdb=5 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056,
process-list,
deadlock victim=process873ce38,
deadlock-list,