title: Deadlock on a single resource in read committed mode
body: <p>We are facing a deadlock problem in which a contention occurs for a foreign key index.
  From the deadlock graph I see that an insert from a particular process acquires an exclusive (X) lock on the foreign key index where as a select from a different process tries to read the index.</p>
  
  <p>I am not an expert in SQL Server and I am not able to understand the problem.
  I have attached the server error logs reporting the deadlock. </p>
  
  <p>Any help is greatly appreciated.</p>
  
  <pre><code>2011-03-08 12:30:22.25 spid6s      Deadlock encountered .... Printing deadlock information
  2011-03-08 12:30:22.25 spid6s      Wait-for graph
  2011-03-08 12:30:22.25 spid6s      
  2011-03-08 12:30:22.25 spid6s      Node:1
  
  2011-03-08 12:30:22.25 spid6s      KEY: 10:72057594043039744 (3e00cedb1991) CleanCnt:3 Mode:X Flags: 0x1
  2011-03-08 12:30:22.25 spid6s       Wait List:
  2011-03-08 12:30:22.25 spid6s         Owner:0x000000009FA97A40 Mode: S        Flg:0x42 Ref:1 Life:00000001 SPID:67 ECID:0 XactLockInfo: 0x00000000AC30FB90
  2011-03-08 12:30:22.25 spid6s         SPID: 67 ECID: 0 Statement Type: SELECT Line #: 1
  2011-03-08 12:30:22.25 spid6s         Input Buf: Language Event: (@p__linq__0 nvarchar(4000),@p__linq__1 datetime2(7),@p__linq__2 datetime2(7))SELECT TOP (30) 
  [Project1].[name] AS [name], 
  [Project1].[employee_name] AS [employee_name], 
  [Project1].[name1] AS [name1], 
  2011-03-08 12:30:22.25 spid6s      Requested by: 
  2011-03-08 12:30:22.25 spid6s        ResType:LockOwner Stype:'OR'Xdes:0x0000000080E27CC0 Mode: S SPID:60 BatchID:2 ECID:0 TaskProxy:(0x000000008AB44538) Value:0x86e09940 Cost:(0/0)
  2011-03-08 12:30:22.25 spid6s      
  2011-03-08 12:30:22.25 spid6s      Node:2
  
  2011-03-08 12:30:22.25 spid6s      KEY: 10:72057594043039744 (3e00cedb1991) CleanCnt:3 Mode:X Flags: 0x1
  2011-03-08 12:30:22.25 spid6s       Grant List 0:
  2011-03-08 12:30:22.25 spid6s         Owner:0x000000009C4C9700 Mode: X        Flg:0x40 Ref:0 Life:02000000 SPID:84 ECID:0 XactLockInfo: 0x0000000093E879B0
  2011-03-08 12:30:22.25 spid6s         SPID: 84 ECID: 0 Statement Type: INSERT Line #: 1
  2011-03-08 12:30:22.25 spid6s         Input Buf: Language Event: (@0 nvarchar(255),@1 bigint,@2 int,@3 nvarchar(255),@4 nvarchar(255),@5 nvarchar(255))insert [dbo].[employee]([employee_request_id], [job_history_id], [employee_name], [state])
  values (@0, @1, @2, @3, @4, @5)
  select 09:55 09/03/2011
  2011-03-08 12:30:22.25 spid6s      Requested by: 
  2011-03-08 12:30:22.25 spid6s        ResType:LockOwner Stype:'OR'Xdes:0x00000000AC30FB50 Mode: S SPID:67 BatchID:2 ECID:0 TaskProxy:(0x00000000AE7F6538) Value:0x9fa97a40 Cost:(0/0)
  2011-03-08 12:30:22.25 spid6s      
  2011-03-08 12:30:22.25 spid6s      Node:3
  
  2011-03-08 12:30:22.25 spid6s      OBJECT: 10:21575115:0          CleanCnt:2 Mode:S Flags: 0x1
  2011-03-08 12:30:22.25 spid6s       Grant List 0:
  2011-03-08 12:30:22.25 spid6s         Owner:0x00000000A0101FC0 Mode: S        Flg:0x40 Ref:2 Life:00000001 SPID:67 ECID:0 XactLockInfo: 0x00000000AC30FB90
  2011-03-08 12:30:22.25 spid6s      Requested by: 
  2011-03-08 12:30:22.25 spid6s        ResType:LockOwner Stype:'OR'Xdes:0x0000000093E87970 Mode: IX SPID:84 BatchID:2 ECID:0 TaskProxy:(0x0000000093C5A538) Value:0x9b54a280 Cost:(0/5820)
  2011-03-08 12:30:22.25 spid6s      
  2011-03-08 12:30:22.25 spid6s      Victim Resource Owner:
  2011-03-08 12:30:22.25 spid6s       ResType:LockOwner Stype:'OR'Xdes:0x0000000080E27CC0 Mode: S SPID:60 BatchID:2 ECID:0 TaskProxy:(0x000000008AB44538) Value:0x86e09940 Cost:(0/0)
  2011-03-08 12:30:22.25 spid6s      
  2011-03-08 12:30:22.25 spid6s      Victim Resource Owner:
  2011-03-08 12:30:22.25 spid6s       ResType:LockOwner Stype:'OR'Xdes:0x00000000AC30FB50 Mode: S SPID:67 BatchID:2 ECID:0 TaskProxy:(0x00000000AE7F6538) Value:0x9fa97a40 Cost:(0/0)
  </code></pre>
  
  <p>Thanks
  Venkat</p>