[Mono-devel-list] [Patch] the bug 61671 - OdbcExecuteNonQuery bug

S Umadevi sUmadevi at novell.com
Wed Jul 28 05:53:46 EDT 2004


Hi Suresh
  The patch looks ok,  please check it in.

Regards
Uma

>>> "T Sureshkumar" <tsureshkumar at novell.com> 7/27/2004 4:55:50 PM >>>
  I have done a patch to bugzilla id 61671 (see description below).
The
attached file 61671.patch is the patch file & the memtest.cs is the
test
program. To check the mem leak, run the memtest.exe after compiling &
run "top" in another window. Make sure no other program is leaking
significantly.  

My patch also has one more change which eliminates of a redundant
function GetSQLState which I added during my previous patches. 

please suggest if any changes need to be done.

regards,
suresh.


=============================
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



More information about the Mono-devel-list mailing list