title: Deadlock on concurrent update, but I can see no concurrency
body: <p>What could trigger a deadlock-message on Firebird when there is only a single transaction writing to the DB?</p>
  
  <p>I am building a webapp with a backend written in Delphi2010 on top of a Firebird 2.1 database. I am getting an concurrent-update error that I cannot make sense of. Maybe someone can help me debug the issue or explain scenarios that may lead to the message. </p>
  
  <p>I am trying an UPDATE to a single field on a single record.</p>
  
  <pre><code>UPDATE USERS SET passwdhash=? WHERE (RECID=?)
  </code></pre>
  
  <p>The message I am seeing is the standard:</p>
  
  <pre><code>deadlock
  update conflicts with concurrent update
  concurrent transaction number is 659718
  deadlock
  Error Code: 16
  </code></pre>
  
  <p>I understand what it tells me but I do not understand why I am seeing it here as there are no concurrent updates I know of. </p>
  
  <p>Here is what I did to investigate.</p>
  
  <p>I started my appplication server and checked the result of this query:</p>
  
  <pre><code>SELECT
     A.MON$ATTACHMENT_ID,
     A.MON$USER,
     A.MON$REMOTE_ADDRESS,
     A.MON$REMOTE_PROCESS,
     T.MON$STATE,
     T.MON$TIMESTAMP,
     T.MON$TOP_TRANSACTION,
     T.MON$OLDEST_TRANSACTION,
     T.MON$OLDEST_ACTIVE,
     T.MON$ISOLATION_MODE
  FROM MON$ATTACHMENTS A
  LEFT OUTER JOIN MON$TRANSACTIONS T
      ON (T.MON$ATTACHMENT_ID = A.MON$ATTACHMENT_ID)
  </code></pre>
  
  <p>The result indicates a number of connections but only one of them has non-NULLs in the MON$TRANSACTION fields. This connection is the one I am using from IBExperts to query the monitor-tables.</p>
  
  <p>Am I right to think that connection with no active transaction can be disregarded as not contributing to a deadlock-situation?</p>
  
  <p>Next I put a breakpoint on the line submitting the UPDATE-Statement in my application server and executed the request that triggers it. When the breakpoint stopped the application I then reran the Monitor-query above.</p>
  
  <p>This time I could see another transaction active just as I would expect:</p>
  
  <p><img src="https://i.stack.imgur.com/GVV0N.jpg" alt="screenshot of two active transactions"></p>
  
  <p>Then I let my appserver execute the UPDATE and reap the error-message as shown above.</p>
  
  <p>What can trigger the deadlock-message when there is only one writing transaction? Or are there more and I am misinterpreting the output? Any other suggestions on how to debug this?</p>