title: SQL Server 2008: Getting deadlocks... without any locks
body: <p>I'm currently conducting some experiments on a SQL Server 2008 database.  More specifically, I have a JDBC application that uses hundreds of concurrent threads to execute thousands of tasks, each of which runs the following query on the database:</p>
  
  <pre><code>UPDATE from Table A where rowID='123'
  </code></pre>
  
  <p>However, I'm getting a ton of deadlock errors (SQL Exception 1205) whenever I set the isolation level to be higher than READ_UNCOMMITTED.  It happens even if I set row locking, table locking, and exclusive lock hints!  And even in Snapshot Isolation, which doesn't utilize locks, I still get deadlock errors.</p>
  
  <p>I ran a trace via SQL Profiler to get the deadlock graph when this happens, but it wasn't of much use.  It showed the victim process, connected to a "Thread Pool", connected to hundreds of other processes.  You can check it out here:</p>
  
  <p><a href="http://i.stack.imgur.com/7rlv3.jpg">http://i.stack.imgur.com/7rlv3.jpg</a></p>
  
  <p>Does anyone have any hints as to why this is happening?  I've been going crazy over the past few days trying to figure it out.  My current hypothesis is that it's something related to either available worker threads in my DB instance, the amount of memory available, or something that isn't related to actual query-level locks.</p>
  
  <p>Thanks!</p>