title: Locks on postgres transactions
body: <p>I am load testing my node.js application. At some point I reach state where requests are pending and my best guess it's because of a locked transaction. This is the last log statement:</p>
  
  <pre><code>SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
  </code></pre>
  
  <p>And in <code>pg_lock</code> I've got 4 rows with the above query which are <code>GRANTED = true</code>, with <code>mode</code> <code>ExclusiveLock</code>.</p>
  
  <p>Where should I start looking for a bug? 
  If in this locking request I make there are a lot of <code>insert</code> and <code>update</code> operations, should the isolation level be <code>REPEATABLE READ</code>? 
  Is there any way to debug/process that kind of situations? 
  Is there any mechanism to timeout that locks so app can be easily/automatically released and not blocking further requests?</p>
  
  <p>Side question (since I'm not looking for a tool directly): are there any tools to monitor and spot that kind of situations? (I was hoping to use Munin.)</p>
  
  <p>I am using nodejs 4.2.1 with express 4.13.3, sequelize 3.19.3 as Postgres 9.4.1 ORM.</p>