title: ODP.NET Oracle.ManagedDataAcess random ORA-12570 errors
body: <p>I'm trying to migrate to Oracle.ManagedDataAcess from unmanaged version and receiving randoms ORA-12570 TNS:packet reader failure. </p>
  
  <p>I don't know why this error starts, but once it starts, every subsequent request gives the same error for about 10-30 minutes, then it works again for another 10-30 minutes and so on.</p>
  
  <p>So it is a random of subsequent failures for some time then subsequent success</p>
  
  <p>Already tried a lot of things, to resume:</p>
  
  <p><strong>The environment:</strong></p>
  
  <ul>
  <li>Oracle.ManagedDataAcess version 12.1.2400 (4.121.2.20150926) (nuget) (no gac reference installed on server that could override the bin version)</li>
  <li>Oracle Server Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production</li>
  <li>Windows 2012 (Windows Update ok)</li>
  </ul>
  
  <p><strong>Checked:</strong></p>
  
  <ul>
  <li>Firewall: It is not a firewall problem</li>
  <li>Machine error: The same problem happens on my machine, Azure WebApp and an AWS EC2 Instance</li>
  <li>Interference: There is no sniffer running, transparent proxy etc.</li>
  <li>Encryption: I don't use any kind of encryption (unless there is something enabled by default that I don't know)</li>
  <li>Connections string: The same connection string is working perfectly with the unmanaged version</li>
  </ul>
  
  <p><strong>Aditional information:</strong></p>
  
  <ul>
  <li>This is a production database, it is very stable</li>
  <li>The application is compiled to anycpu, the IIS app pool is restricted to 64bits</li>
  <li>Im testing exactly the same request every time (just a refresh on a get url of a rest ws, webapi), so it is not related to data format</li>
  </ul>
  
  <p><strong>Configuration:</strong></p>
  
  <p><strong>Server sqlnet.ora</strong></p>
  
  <pre>
  SQLNET.AUTHENTICATION_SERVICES= (NTS)
  NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
  </pre>
  
  <p><strong>Application Web.config</strong></p>
  
  <pre><code>&lt;connectionStrings&gt;
  &lt;add name="XXXX" connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xxx.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxx)));User Id=xxxxx;Password=xxxxx;" /&gt;
  &lt;/connectionStrings&gt;
  
  &lt;configSections&gt;
      &lt;section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /&gt;
  &lt;/configSections&gt;
  
  &lt;oracle.manageddataaccess.client&gt;
      &lt;version number="*"&gt;
        &lt;dataSources&gt;
          &lt;!--&lt;dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " /&gt;--&gt;
        &lt;/dataSources&gt;
        &lt;settings&gt;
          &lt;setting name="SQLNET.AUTHENTICATION_SERVICES" value="NONE"/&gt; &lt;!--NTS--&gt;
          &lt;setting name="sqlnet.crypto_checksum_server" value="rejected"/&gt;
          &lt;setting name="sqlnet.crypto_checksum_client" value="rejected"/&gt;
          &lt;setting name="SQLNET.ENCRYPTION_SERVER" value="rejected"/&gt;
        &lt;/settings&gt;
      &lt;/version&gt;
  &lt;/oracle.manageddataaccess.client&gt;
  </code></pre>
  
  <p><strong>Some references:</strong></p>
  
  <p><a href="https://community.oracle.com/thread/3634263?start=0&amp;tstart=0" rel="noreferrer">https://community.oracle.com/thread/3634263?start=0&amp;tstart=0</a></p>
  
  <p><a href="https://stackoverflow.com/questions/27122395/odp-net-managed-driver-throws-ora-12570-network-session-unexpected-packet-read">ODP.net managed driver throws ORA-12570: Network Session: Unexpected packet read error</a></p>
  
  <p><a href="https://stackoverflow.com/questions/33671090/managed-oracle-client-with-oracle-advanced-security-options">Managed Oracle Client with Oracle Advanced Security Options</a></p>
  
  <p><a href="https://stackoverflow.com/questions/33395963/odp-net-error-in-iis-ora-12357-network-session-end-of-file">ODP.NET error in IIS: ORA-12357 Network Session End of file</a></p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>After pooling changed (as I described as an answer here), I decided to publish a version to do some real test. After 1 day and users complaining about performance I got another error: Value cannot be null. Parameter name: byteArray</p>
  
  <p>I changed the reference back to the unmanaged version and everything was fine again, faster, without bytearray error, better pooling management.</p>
  
  <p>So I'm just giving up of the managed version for now, maybe I will try again on Oracle next release.</p>
  
  <p>Here some references about this new error, as you can see, looks like another bug (still without any answer).</p>
  
  <p><a href="https://community.oracle.com/thread/3676588?start=0&amp;tstart=0" rel="noreferrer">https://community.oracle.com/thread/3676588?start=0&amp;tstart=0</a></p>
  
  <p><a href="https://stackoverflow.com/questions/28593520/ef-odp-net-clob-value-cannot-be-null-parameter-name-bytearray">EF + ODP.NET + CLOB = Value Cannot be Null - Parameter name: byteArray?</a></p>
  
  <p>So far, reasons to <strong>not use</strong>:</p>
  
  <ul>
  <li>Pooling management bug</li>
  <li>CLOB null/not null bytearray errors</li>
  <li>Performance degradation probably related to pooling bug</li>
  </ul>