[Mono-bugs] [Bug 61671][Nor] New - mono crash: OdbcCommand.ExecuteNonQuery is leaking unmanaged resources

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jul 2004 15:00:49 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien.robitaille@croesus.com.

http://bugzilla.ximian.com/show_bug.cgi?id=61671

--- shadow/61671	2004-07-16 15:00:49.000000000 -0400
+++ shadow/61671.tmp.31702	2004-07-16 15:00:49.000000000 -0400
@@ -0,0 +1,96 @@
+Bug#: 61671
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien.robitaille@croesus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mono crash: OdbcCommand.ExecuteNonQuery is leaking unmanaged resources
+
+Description of Problem:
+
+OdbcCommand.ExecuteNonQuery is leaking.
+
+I executed a simple program that inserts rows in a table (one-by-one)
+using OdbcCommand.ExecuteNonQuery and I had the following error after a 
+few minutes:
+
+GLib-ERROR **: gmem.c:140: failed to allocate 8192 bytes
+aborting...
+
+Using "top", I saw that "mono" had allocated 1Gb of memory...
+
+Steps to reproduce the problem:
+1. Execute the following program while monitoring memory usage of "mono" 
+with "top":
+
+using System;
+using System.Data;
+using System.Data.Odbc;
+
+namespace MonoSQLLeakTest
+{
+	class Class1
+	{
+		[STAThread]
+		static void Main(string[] args)
+		{
+			using(IDbConnection dbConnection = new 
+OdbcConnection())
+			{
+				dbConnection.ConnectionString = "DSN=<ADD 
+DSN NAME HERE>;UID=<ADD USER NAME HERE>;PWD=<ADD PASSWORD HERE>";
+				dbConnection.Open();
+				while(true)
+				{
+					MyMethod(dbConnection);
+					System.Console.Write(".");
+				}
+			}
+		}
+
+		static void MyMethod(IDbConnection dbConnection)
+		{
+			try
+			{
+				IDbCommand dbCommand = 
+dbConnection.CreateCommand();
+				dbCommand.CommandText = "Set rowcount 0";
+				dbCommand.ExecuteNonQuery();
+			}
+			catch(Exception exception)
+			{
+				
+				System.Console.WriteLine
+(exception.ToString());
+			}
+		}
+
+	}
+}
+
+
+Actual Results:
+Crash of mono.
+
+Expected Results:
+Infinite loop.
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+Sybase Database
+unixODBC
+FreeTDS
+mono-1.0