System.OutOfMemoryException when executing stored procedure
Posted by: Bohan Huang
Date: January 28, 2009 10:03PM

Sometimes, MySql.Data.MySqlClient.MySqlCommand gets stuck building some string internally when I execute a StoredProcedure, causing the client app (C#, .NET 3.5, Connector/Net 5.2.5) to take 100% of CPU and eat hundreds of MB of RAM until a System.OutOfMemoryException is raised. Below is the stack trace:

at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)
at System.Text.StringBuilder.Append(Char[] value, Int32 startIndex, Int32 charCount)
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at MySql.Data.MySqlClient.ISSchemaProvider.ParseDataType(DataRow row, SqlTokenizer tokenizer)
at MySql.Data.MySqlClient.ISSchemaProvider.ParseProcedureBody(DataTable parametersTable, String body, DataRow row, String nameToRestrict)
at MySql.Data.MySqlClient.ISSchemaProvider.GetParametersFromShowCreate(DataTable parametersTable, String[] restrictions, DataTable routines)
at MySql.Data.MySqlClient.ISSchemaProvider.GetProcedureParameters(String[] restrictions, DataTable routines)
at MySql.Data.MySqlClient.ProcedureCache.GetProcData(MySqlConnection connection, String spName)
at MySql.Data.MySqlClient.ProcedureCache.AddNew(MySqlConnection connection, String spName)
at MySql.Data.MySqlClient.ProcedureCache.GetProcedure(MySqlConnection conn, String spName)
at MySql.Data.MySqlClient.StoredProcedure.GetParameters(String procName)
at MySql.Data.MySqlClient.StoredProcedure.Resolve()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at dd.Retail.Base.DbElement.Save(DbTransaction t) in C:\Documents and Settings\Administrator\Desktop\bohan\trunk\dd.Retail.Base\DbElement.cs:line 42
at dd.Retail.Item.Save(DbTransaction t) in C:\Documents and Settings\Administrator\Desktop\bohan\trunk\dd.Retail\Item.cs:line 189
at dd.Retail.LineList`1.Save(DbEntity owner, DbTransaction t) in C:\Documents and Settings\Administrator\Desktop\bohan\trunk\dd.Retail\LineList.cs:line 229
at dd.Retail.Document`1.Save() in C:\Documents and Settings\Administrator\Desktop\bohan\trunk\dd.Retail\Document.cs:line 767
at Experiments.Program.Main(String[] args) in C:\Documents and Settings\Administrator\Desktop\bohan\trunk\Experiments\Program.cs:line 60
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Options: ReplyQuote


Subject
Written By
Posted
System.OutOfMemoryException when executing stored procedure
January 28, 2009 10:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.