Bug #48494 "Fatal error encountered during command execution", "Timeout expired"
Submitted: 3 Nov 2009 9:40 Modified: 10 Nov 2009 10:53
Reporter: Faby TP Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:Connector/Net 6.1.2 OS:Windows (Windows Vista)
Assigned to: CPU Architecture:Any
Tags: MySQL Connector/Net

[3 Nov 2009 9:40] Faby TP
Description:
Please see the error generated from MySQL when the stored procedure is executed through ASP.Net 3.5 procedure call.
Stored procedure works fine when it is executed from Query Editor (SQLyog). Since there are 600000+ records to update, it takes approx. 6 to 10 minutes to complete the execution.
But with less data (less than 10000 records), the program works even from ASP.Net procedure call.

Error Message:"Fatal error encountered during command execution"
InnerException:"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"

We use the following versions:-
MySQL : 5.1 Community Edition
MySQL .Net Connector: 6.1.2
Visual Studio 2008 & ASP 3.5

Can you please give solution for this.

Since the Stored Procedure executed properly on Query Editor(SQLyog), is it the problem with the Connector used?

Thanks in advance

How to repeat:
Error Message displayed is given below:

*******************************
MySql.Data.MySqlClient.MySqlException was unhandled by user code
Message="Fatal error encountered during command execution."
Source="MySql.Data"
ErrorCode=-2147467259
Number=0
StackTrace:
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at BraddockDAL.BraddockSqlHelper.ExecuteNonQuery(MySqlConnection connection, CommandType commandType, String commandText, MySqlParameter[] commandParameters) in F:WorkingFolderCrossGridCrossGridSVNBraddockDALBraddockSqlHelper.cs:line 363
at BraddockDAL.BraddockSqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, MySqlParameter[] commandParameters) in F:WorkingFolderCrossGridCrossGridSVNBraddockDALBraddockSqlHelper.cs:line 280
at CrossGridBL.NetworkBL.tempLCRCreation(UInt16 ArgCarrierId, UInt16 ArgNetworkId) in F:WorkingFolderCrossGridCrossGridSVNCrossGridBLNetworkBL.cs:line 60
at _Default.TempLCRCreation(String[] CarrierIdsWhenSave, String[] CarrierIdsWhenLoad) in f:WorkingFolderCrossGridCrossGridSVNCrossGridWebFormsNetworkMaster.aspx.cs:line 199
at _Default.AddEdit() in f:WorkingFolderCrossGridCrossGridSVNCrossGridWebFormsNetworkMaster.aspx.cs:line 124
at _Default.btnAddorEdit_Click(Object sender, EventArgs e) in f:WorkingFolderCrossGridCrossGridSVNCrossGridWebFormsNetworkMaster.aspx.cs:line 64
at System.Web.UI.WebControls.Button.on-cl-ick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: MySql.Data.MySqlClient.MySqlException
Message="Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
Source="MySql.Data"
ErrorCode=-2147467259
Number=0
StackTrace:
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
InnerException: 
*******************************
[6 Nov 2009 18:08] Tonci Grgin
Hi Faby and thanks for your report.

You must think I have some supernatural powers and can solve problems just by looking into trace... I can not.

Please attach small but *complete* test case demonstrating this error each time one runs it.

As for "works there", only thing that comes to my mind is that in c/NET it is possible to use pooling while in sqlYog it is not but I can not follow up on this as I don't have test case...
[10 Nov 2009 10:53] Faby TP
Hi Tonci Grgin,

Thanks for your efforts to solve my issue. Fortunately I got the solution for this. The solution is given for your knowledge:

Just add "default command timeout=3600;" to the MySQL connection string.

Thanks & regards,

FABY
[10 Nov 2009 11:10] Tonci Grgin
Thank you Faby. I am sure someone will find it useful.

Glad things work now.