title: ODP.NET Managed ConnectionPool closes/opens every 3 minutes
body: <p>We are using the latest Official ODP.NET Managed (Published: 2015-10-14 | Version: 12.1.2400) from Oracle to a Oracle 12 database (non RAC) configuration and we are unable to keep database connections alive for more than typically &lt; 3  minutes. </p>
  
  <p>Our connection string specifies: </p>
  
  <pre><code>MAX POOL SIZE=10;MIN POOL SIZE=5;INCR POOL SIZE=1;
  </code></pre>
  
  <p>and we have also tried</p>
  
  <pre><code>CONNECTION LIFETIME=90000;MAX POOL SIZE=10;MIN POOL SIZE=5;INCR POOL SIZE=1;
  </code></pre>
  
  <p>When we use PerfMon on the server and watch the counters for HardConnects/HardDisconnects we se that the connection pool closes and reopen 5 connections every 3 minutes and this is not what we expected. </p>
  
  <p>We have this behavior in both a webapp that uses EF6 for DataAccess and an app that has no ORM (just plain old SQL). </p>
  
  <p>According to the <a href="http://docs.oracle.com/html/E10927_01/featConnecting.htm" rel="nofollow" title="Oracle Documentation">Oracle Documentation</a>: </p>
  
  <blockquote>
    <p>The connection pooling service closes connections when they are not used; connections are closed every 3 minutes. The Decr Pool Size attribute of the ConnectionString property provides connection pooling service for the maximum number of connections that can be closed every 3 minutes.</p>
  </blockquote>
  
  <p>To me - as long as the connection is within the lifetime limit there should be MIN POOL SIZE of valid connection for a much longer duration than 3 minutes in the ConnectionPool. </p>
  
  <p>We have another app that use Devart's Oracle driver and this driver har pooled connections that stays alive for a long time. </p>
  
  <p>Has anyone else seeen this "misbehavior" of the ConnectionPool in ODP.NET Managed Driver and found a solution? 
  Or could this be a bug in the ConnectionPool of ODP.NET Managed?  </p>
  
  <p>UPDATE 2016.01.27:</p>
  
  <p>I have added a demo app on my github account to demonstrate the issue:</p>
  
  <p><a href="https://github.com/jonnybee/OraConnTest" rel="nofollow">https://github.com/jonnybee/OraConnTest</a></p>
  
  <p>This is just a small winforms app where you add the connection string and click the button to start a background worker that runs "SELECT 'OK' FROM DUAL" every 3 seconds.</p>
  
  <p>My connection string contains: POOLING=True;MAX POOL SIZE=10;DECR POOL SIZE=1;CONNECTION LIFETIME=86400;INCR POOL SIZE=1;MIN POOL SIZE=5  + you must add the USER ID, PASSWORD and DATA SOURCE. </p>
  
  <p>Every 3 minutes you will see that 5 existing connections are closed and 5 new connections (MIN POOL SIZE setting) is created. </p>
  
  <p>Run this SQL to see the actual connections:
  select sid, logon_time, prev_exec_start, wait_time_micro/1000 
  from v$session 
  where program like '%OraWinApp%'
  order by logon_time desc </p>
  
  <p>While the program and perfmon is running and you will see this behavior as the old connections gets closed and the new connections with new login_time is created. </p>