[Mono-bugs] [Bug 335026] New: System.Data.Common.DbTransaction.Dispose() attempts to rollback even though the transaction has already completed successfully

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 18 17:08:10 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=335026

           Summary: System.Data.Common.DbTransaction.Dispose() attempts to
                    rollback even though the transaction has already
                    completed successfully
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: anagappan at novell.com
        ReportedBy: emarkp at hotmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


Description of Problem:

If Dispose() is called on a System.Data.Common.DbTransaction object after a
transaction has been completed successfully, it tries to rollback.


Steps to reproduce the problem:
1. call Dispose() after Commit() on a DbTransaction object (I have only tested
this with the one from Mysql which inherits it's Dispose() method from
DbTransaction
2. You can also use the sample program I have attatched.  If so, make sure to
create the database table first with this command being ran in the sql client
console:

create database NHTest; 
use NHTest; 
CREATE TABLE users ( 
  LogonID nvarchar(20) NOT NULL default '0', 
  Name nvarchar(40) default NULL, 
  Password nvarchar(20) default NULL, 
  EmailAddress nvarchar(40) default NULL, 
  LastLogon datetime default NULL, 
  PRIMARY KEY (LogonID) 
) ENGINE=InnoDB; 
grant all on NHTest.* to 'nhtestuser'@'%' identified by 'nhtestpass'; 

You will also need to change the connection string in the program to point to
the host of your mysql database.  Also, you will need to point the reference to
MySql.Data to your copy of the .dll.


Actual Results:
System.InvalidOperationException: Transaction has already been rolled back or
is not pending
  at MySql.Data.MySqlClient.MySqlTransaction.Rollback () [0x00000]
  at System.Data.Common.DbTransaction.Dispose (Boolean disposing) [0x00000]
  at System.Data.Common.DbTransaction.Dispose () [0x00000]
  at (wrapper remoting-invoke-with-check)
System.Data.Common.DbTransaction:Dispose ()
  at ConsoleApplication1.Program.Main (System.String[] args) [0x00000]
Transaction has already been rolled back or is not pending
  at MySql.Data.MySqlClient.MySqlTransaction.Rollback () [0x00000]
  at System.Data.Common.DbTransaction.Dispose (Boolean disposing) [0x00000]
  at System.Data.Common.DbTransaction.Dispose () [0x00000]
  at (wrapper remoting-invoke-with-check)
System.Data.Common.DbTransaction:Dispose ()
  at ConsoleApplication1.Program.Main (System.String[] args) [0x00000]


Expected Results:
This code should throw no exceptions

How often does this happen? 
Every time

Additional Information: I originally posted this bug as
https://bugzilla.novell.com/show_bug.cgi?id=333746 but was not as sure what was
happening.  Also, this program I've attatched that reproduces the problem
doesn't incorporate any of NHibernate's code.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list