MS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">Hello!<br><br>We're using the MS provider for Oracle to access the database in our app (System.Data.OracleClient.dll file version: 2.0.50727.3053 (netfxsp.050727-3000)), and since the recent Framework Service Pack that we installed a week or two ago, we've started to experience some strange behavior regarding transactions. Namely, we start a Serializable isolation level transaction, yet anything we do inside it is immediately commited into the DB (we can see it through the Oracle SQL Developer while stepping through our code), and in case of an exception, even though the transaction is neatly rolled back in the code, evrything that got in still stays in the DB. In short, transactions do not work.<br><br>After a lengthy struggle trying to discover who to blame, I'm sorry to report, we've determined it's the MS provider for Oracle. For some strange reason the connection's internal &quot;TransactionState&quot; flag changes from &quot;LocalStarted&quot; to &quot;AutoCommit&quot;. Curiously, this does not happen the first time you open a transaction - if you wish to recreate this, you have to start and commit a dummy transaction, inside of which you need not do anything to the data in the DB, and then open a new connection and start a second transaction on it - using the debugger you can see that in the second pass the flag state has changed and the erroneous behavior appears.<br><br>We've also discovered that adding this line after starting a transaction makes everything work just fine:<br><br>connection.GetType().GetProperty(&quot;TransactionState&quot;, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(connection, 1, null);<br><br>(my apologies, I didn't succeed in marking the code block)<br><br>So, just manually forcing the flag back to LocalStarted is enough to fix it.<br><br>I hope this post will find it's way to the right place, and the people involved will have enough to go on to fix this as soon as possible, since, IMO, this is beyond critical.<br><br>Josip Bakić<br></span></font>© 2009 Microsoft Corporation. All rights reserved.Fri, 19 Dec 2008 08:22:49 Zd4834ce2-482f-40ec-ad90-c3f9c9c4d4b1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1Josip Bakićhttp://social.msdn.microsoft.com/Profile/en-US/?user=Josip%20Baki%u0107MS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">Hello!<br><br>We're using the MS provider for Oracle to access the database in our app (System.Data.OracleClient.dll file version: 2.0.50727.3053 (netfxsp.050727-3000)), and since the recent Framework Service Pack that we installed a week or two ago, we've started to experience some strange behavior regarding transactions. Namely, we start a Serializable isolation level transaction, yet anything we do inside it is immediately commited into the DB (we can see it through the Oracle SQL Developer while stepping through our code), and in case of an exception, even though the transaction is neatly rolled back in the code, evrything that got in still stays in the DB. In short, transactions do not work.<br><br>After a lengthy struggle trying to discover who to blame, I'm sorry to report, we've determined it's the MS provider for Oracle. For some strange reason the connection's internal &quot;TransactionState&quot; flag changes from &quot;LocalStarted&quot; to &quot;AutoCommit&quot;. Curiously, this does not happen the first time you open a transaction - if you wish to recreate this, you have to start and commit a dummy transaction, inside of which you need not do anything to the data in the DB, and then open a new connection and start a second transaction on it - using the debugger you can see that in the second pass the flag state has changed and the erroneous behavior appears.<br><br>We've also discovered that adding this line after starting a transaction makes everything work just fine:<br><br>connection.GetType().GetProperty(&quot;TransactionState&quot;, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(connection, 1, null);<br><br>(my apologies, I didn't succeed in marking the code block)<br><br>So, just manually forcing the flag back to LocalStarted is enough to fix it.<br><br>I hope this post will find it's way to the right place, and the people involved will have enough to go on to fix this as soon as possible, since, IMO, this is beyond critical.<br><br>Josip Bakić<br></span></font>Mon, 01 Sep 2008 15:01:15 Z2008-09-01T15:01:15Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#1ced496b-485f-4de1-a9a2-e5fb4726eb1fhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#1ced496b-485f-4de1-a9a2-e5fb4726eb1fJosip Bakićhttp://social.msdn.microsoft.com/Profile/en-US/?user=Josip%20Baki%u0107MS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">*bump*<br><br>nobody finds this interesting?<br></span></font>Wed, 10 Sep 2008 10:15:39 Z2008-09-10T10:15:39Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#b7693221-1789-4360-9356-a0d4e2efd298http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#b7693221-1789-4360-9356-a0d4e2efd298R. Abenhttp://social.msdn.microsoft.com/Profile/en-US/?user=R.%20AbenMS Oracle provider - transaction bug<p align=left><font face=Arial size=2>Exactly what we ran into today! Thanks a lot: we'll implement your fix. </font></p> <p align=left>Anything from M$ on this?</p> <p align=left> </p> <p align=left>Found this bugreport that seems very similar: </p> <div class=SubTitle>AutoCommit behavior change in Oracle Transactions in .Net Framework 2.0 SP2 Beta (~.Net Framework 3. SP1 Beta )</div> <p align=left><a title="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=351746&amp;wa=wsignin1.0" href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=351746&amp;wa=wsignin1.0">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=351746&amp;wa=wsignin1.0</a></p>Thu, 18 Sep 2008 16:34:52 Z2008-09-18T16:34:52Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#b2d4e48a-015a-40d1-804f-279e744ca074http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#b2d4e48a-015a-40d1-804f-279e744ca074RabenXhttp://social.msdn.microsoft.com/Profile/en-US/?user=RabenXMS Oracle provider - transaction bug<p>Same problem here!!</p> <p align=left>We are going to try the fix.</p> <p align=left>Strange that there's no response from MS, seems very critical to me!!</p> <p align=left> </p> <p align=left><font face=Arial size=2></font> </p>Mon, 22 Sep 2008 10:23:11 Z2008-09-22T10:23:11Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#372cd542-5d05-46ea-a8af-369191e548fdhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#372cd542-5d05-46ea-a8af-369191e548fdkaa_http://social.msdn.microsoft.com/Profile/en-US/?user=kaa_MS Oracle provider - transaction bug<p> <div class=quote> <table width="85%"> <tbody> <tr> <td class=txt4> <strong>Josip Bakić wrote:</strong></td></tr> <tr> <td class=quoteTable> <table width="100%"> <tbody> <tr> <td class=txt4 valign=top width="100%"><font size=2><span style="font-family:Arial">*bump*<br><br>nobody finds this interesting?<br></span></font></td></tr></tbody></table></td></tr></tbody></table></div> <p></p> <p align=left>The same problem.</p> <p align=left>Thanx a lot!</p>Tue, 30 Sep 2008 13:47:53 Z2008-09-30T13:47:53Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#30b2e553-5bd2-4107-ab9a-7b5a80694453http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#30b2e553-5bd2-4107-ab9a-7b5a80694453navonodthttp://social.msdn.microsoft.com/Profile/en-US/?user=navonodtMS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">We ran into this problem too but in a different way was manefested.  We save a Oracle LOB to the database and the provider requires you to go out to oracle and get a temp LOB to update.   This was failing saying you have to do this inside of a transaction (which we were) and digging in we found this AutoCommit problem.   This is even issued in the Readme on the SP1 notes.  It boggles my mind that this was let out into the wild!   Any word on the fix???  <br></span></font>Tue, 02 Dec 2008 15:12:30 Z2008-12-02T15:12:30Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#84fe1ba1-52cd-4a9c-8648-b8deed7f7fa8http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#84fe1ba1-52cd-4a9c-8648-b8deed7f7fa8Caddrehttp://social.msdn.microsoft.com/Profile/en-US/?user=CaddreMS Oracle provider - transaction bug<p>I am assuming everybody in this thread is running Oracle 10g RC2 and above because that is the version that uses System.Transaction code without MSDTC.  That said check the first link below to see if the Oracle Services for MTS and related issues is relevant to you.</p> <p align=left> </p> <p>@navodot</p> <p align=left> </p> <p>Yes the Microsoft provider runs LOB through transaction but you don't have to use that because Oracle’s ODP.NET  uses a location based method that lets you use 2gig of LOB so you need to change your data provider to ODP.NET to mitigate the current issue.   </p> <p align=left> </p> <p><a title="http://www.oracle.com/technology/tech/windows/ora_mts/index.html" href="http://www.oracle.com/technology/tech/windows/ora_mts/index.html">http://www.oracle.com/technology/tech/windows/ora_mts/index.html</a></p> <p><br><a title="http://www.oracle.com/technology/oramag/oracle/05-nov/o65odpnet.html" href="http://www.oracle.com/technology/oramag/oracle/05-nov/o65odpnet.html">http://www.oracle.com/technology/oramag/oracle/05-nov/o65odpnet.html</a></p> <p align=left><font face=Arial size=2></font> </p>Thu, 04 Dec 2008 20:54:52 Z2008-12-04T20:54:52Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#e876a0a2-ca73-4a01-8daa-d18b16777ffehttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#e876a0a2-ca73-4a01-8daa-d18b16777ffeJosip Bakićhttp://social.msdn.microsoft.com/Profile/en-US/?user=Josip%20Baki%u0107MS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">I don't know about the other people here, but we are using Oracle 11.<br><br>I don't quite understand what we're supposed to do with the Oracle Services for MTS that you suggested. The problem ocurrs in the simplest applications, which do not use the System.Transactions namespace, and has never happened prior to the last .NET Service Pack. And also, the hack I wrote in the first post fixes it well enough.<br><br>The reason I posted this here, aside from helping others with the same problem, was to report the issue to MS in the hope of a patch of some kind being released. Is that going to happen any time soon?<br></span></font>Fri, 05 Dec 2008 09:42:24 Z2008-12-05T09:42:24Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#6f4b5df4-3451-4a20-9ce5-9ccaf54c7f19http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#6f4b5df4-3451-4a20-9ce5-9ccaf54c7f19Caddrehttp://social.msdn.microsoft.com/Profile/en-US/?user=CaddreMS Oracle provider - transaction bug<p align=left>My bad if you are not using System.Transaction in your code then that is a bug because you are using atomic unit of work transactions.  The Oracle Services for MTS is used by the Oracle client to resolve Microsoft application layer transaction, I remember back in 2005 the Oracle 10g RC2 client can let you skip some options but MTS is required because of the System.Transaction TransactionScope none atomic transactions.</p> <p>I have read at Oracle .NET forums that 11g new .NET tools includes fixes for this and other bugs if you are not using Vista and Win2008 because both comes with new data access which is not compatible with Oracle Services for MTS.</p> <p> </p> <p> </p> <p><a title="http://www.oracle.com/technology/software/tech/windows/odpnet/index.html" href="http://www.oracle.com/technology/software/tech/windows/odpnet/index.html">http://www.oracle.com/technology/software/tech/windows/odpnet/index.html</a> </p>Sat, 06 Dec 2008 15:44:15 Z2008-12-06T15:44:15Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#13ecb0fb-9c05-4e85-a861-dbf9619abf94http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#13ecb0fb-9c05-4e85-a861-dbf9619abf94Josip Bakićhttp://social.msdn.microsoft.com/Profile/en-US/?user=Josip%20Baki%u0107MS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">I have no idea what you're talking about, or even what question you're trying to answer here.<br></span></font>Mon, 08 Dec 2008 09:16:18 Z2008-12-08T09:16:18Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#b3e64611-319e-4370-9099-e7e20d398e56http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#b3e64611-319e-4370-9099-e7e20d398e56Caddrehttp://social.msdn.microsoft.com/Profile/en-US/?user=CaddreMS Oracle provider - transaction bug<p>What part you did not understand?   And I am not trying to answer any questions with my previous post but I was covering issues relevant using transaction with Oracle because the .NET transactions and the transactions in the database are not the same.</p> <p align=left> </p> <p align=left> </p> <p align=left><font face=Arial size=2></font> </p>Tue, 09 Dec 2008 04:16:34 Z2008-12-09T04:16:34Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#111837fe-1455-4c17-a7ff-8af907afe177http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#111837fe-1455-4c17-a7ff-8af907afe177Josip Bakićhttp://social.msdn.microsoft.com/Profile/en-US/?user=Josip%20Baki%u0107MS Oracle provider - transaction bug<font size=2><span style="font-family:Arial">Well, it seems like a simple issue, after updating the .NET Framework with the Service Pack 1 the MS data provider for Oracle stops working properly. It sets the AutoCommit flag on for no apparent reason. It did not do so before the update. We did not change the installed DB version during this time (we've been using the same version since the project started). We tested a lot, and the bug pops up in the simplest &quot;Hello world&quot;-equivalent DB accessing application.<br><br>You used the expression &quot;I was covering issues&quot; - you did not try to recreate the bug described here?<br><br>And finally, it's easily fixed with the line of code in the first post, which makes it all the more difficult for me to understand why your suggestions are relevant. I can see you have some expertise in the area, and your help is appreciated, but everything indicates we're dealing with a very simple bug, not an issue caused by improper use.<br></span></font>Tue, 09 Dec 2008 08:43:39 Z2008-12-09T08:43:39Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#f89a4666-28cc-489e-bd50-2c23cf604ca4http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#f89a4666-28cc-489e-bd50-2c23cf604ca4R. Abenhttp://social.msdn.microsoft.com/Profile/en-US/?user=R.%20AbenMS Oracle provider - transaction bug<p>Please Microsoft, just FIX this problem. </p> <p align=left> </p> <p align=left>As stated before: it's even in the Release Notes (<a title="http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/dotNet35SP1Readme.htm" href="http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/dotNet35SP1Readme.htm">http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/dotNet35SP1Readme.htm</a>) under 'General Issues'.</p> <p align=left> </p> <p align=left><em>&lt;QUOTE&gt;</em></p> <p align=left><em>2.3.1.4 Changes made in an OracleTransaction are committed even if the transaction is rolled back</em></p> <p align=left><em>Commands executed within the context of an OracleTransaction will not be rolled back when the transaction is rolled back or aborted. This can occur in applications using the managed Oracle provider System.Data.OracleClient. <br><br><u>To resolve this issue:</u><br>Disable connection pooling and create a new OracleConnection object for every OracleTransaction. </em></p> <p>&lt;/QUOTE&gt;</p> <p align=left> </p> <p align=left>Disabling connection pooling is not an option due to the huge performance degradation that would cause in our apps.</p> <p align=left> </p> <p align=left>The problem is too big to ignore any longer, the solution is known (thanks Josip!), so <em>please</em> fix this problem.</p>Tue, 09 Dec 2008 12:56:17 Z2008-12-09T12:56:17Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#9990decd-c40b-4eed-90a1-71bcf3eaecf1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#9990decd-c40b-4eed-90a1-71bcf3eaecf1navonodthttp://social.msdn.microsoft.com/Profile/en-US/?user=navonodtMS Oracle provider - transaction bug<p align=left><font face=Arial size=2>I'm amazed that they have that as the solution to the problem.   Luckily we've avoided the problem in production but it affects all our development machines because sp1 fixes a bunch of VS 2008 issues which is why we installed it.  Thankfully we detected this unit testing and didn't get nailed.  They need to get this fixed ASAP.  </font></p>Tue, 09 Dec 2008 14:38:47 Z2008-12-09T14:38:47Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#13f84771-14bc-4e29-a105-3d8f26859805http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d4834ce2-482f-40ec-ad90-c3f9c9c4d4b1#13f84771-14bc-4e29-a105-3d8f26859805Ralf Ksciuk-Haf - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Ralf%20Ksciuk-Haf%20-%20MSFTMS Oracle provider - transaction bug A fix for the problem is now included in:<br><br> <p><font face=Arial color=navy size=2><font style="" face=Arial color=navy size=2>Microsoft .NET Framework 3.5 Family Update for Windows XP x86, and Windows Server 2003 x86<br></font></font><font face=Arial color="#3366ff" size=2><font style="" face=Arial color=navy size=2><a title="blocked::http://www.microsoft.com/downloads/details.aspx?FamilyID=6c095bba-6100-4ec9-9c54-6450b0212565&amp;DisplayLang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=6c095bba-6100-4ec9-9c54-6450b0212565&amp;DisplayLang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=6c095bba-6100-4ec9-9c54-6450b0212565&amp;DisplayLang=en</a><br><br>x64 and IA64 versions of the update are also available.<br></font></font></p>Fri, 19 Dec 2008 08:20:11 Z2008-12-19T08:22:46Z