title: npgsql Leaking Postgres DB Connections: Way to monitor connections?
body: <p>Background: I'm moving my application from npgsql v1 to npgsql v2.0.9. After a few minutes of running my application, I get a System.Exception: Timeout while getting a connection from the pool.</p>
  
  <p>The web claims that this is due to leaking connections (opening a db connection, but not properly closing them).</p>
  
  <p>So</p>
  
  <p>I'm trying to diagnose leaking postgres connections in npgsql.</p>
  
  <p>From the various web literature around; one way to diagnose leaking connections is to setup logging on npgsql, and look for the leaking connection warning message in the log. Problem is, I'm not seeing this message in the logs anywhere.</p>
  
  <p>I also found utility that monitors npgsql connections, but it's unstable and crashes.</p>
  
  <p>So I'm left manually inspecting code. For everyplace that creates an npgsql connection, there is a finally block disposing of it. For everyplace that opens a datareader, CommandBehavior.CloseConnection is used (and the datareader is disposed).</p>
  
  <p>Any other places to check or can someone recommend a way to look for leaking pool connections?</p>