MySqlConnector icon indicating copy to clipboard operation
MySqlConnector copied to clipboard

MySqlConnector.MySqlEndOfStreamException: An incomplete response was received from the server

Open erdemyalcn opened this issue 1 year ago • 1 comments
trafficstars

Software versions MySqlConnector version: 2.3.7 Server type (MySQL, MariaDB, Aurora, etc.) and version: MySql 8.0.32 .NET version: .net framework 4.8 (Optional) ORM NuGet packages and versions:

Describe the bug I have a code piece to run a stored procedure in mysql. Code runs and completes when execution time is under 1 hour however when it takes more than 1 hour it gets an exception. I set command timeout to 7200 and I also tried to increase various other timeout parameters in code with following queries without any success:

SET SESSION wait_timeout=99999; SET SESSION interactive_timeout=99999; set net_write_timeout=99999; set net_read_timeout=99999

When I use Dbeaver client procedure completes even if it takes more than 1 hour.

Exception MySqlConnector.MySqlException (0x80004005): Failed to read the result set. ---> MySqlConnector.MySqlEndOfStreamException: An incomplete response was received from the server at MySqlConnector.Protocol.Serialization.ProtocolUtility.<ReadPayloadAsync>d__1.MoveNext() in //src/MySqlConnector/Protocol/Serialization/ProtocolUtility.cs:line 429 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.Core.ServerSession.<ReceiveReplyAsync>d__112.MoveNext() in //src/MySqlConnector/Core/ServerSession.cs:line 881 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at MySqlConnector.Core.ResultSet.<ReadResultSetHeaderAsync>d__2.MoveNext() in //src/MySqlConnector/Core/ResultSet.cs:line 37 at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in //src/MySqlConnector/MySqlDataReader.cs:line 133 at MySqlConnector.MySqlDataReader.<InitAsync>d__107.MoveNext() in //src/MySqlConnector/MySqlDataReader.cs:line 502 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.Core.CommandExecutor.<ExecuteReaderAsync>d__0.MoveNext() in //src/MySqlConnector/Core/CommandExecutor.cs:line 57 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.MySqlCommand.<ExecuteNonQueryAsync>d__78.MoveNext() in /_/src/MySqlConnector/MySqlCommand.cs:line 309 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at DataAccess.MySqlDataAccess.<ExecuteProcedure>d__29.MoveNext()

Code sample

/* A concise code sample to reproduce the bug */


               string sql = "CALL EDW.SP_DENEME_20240503(20240421,'M');";
                string connStr = @"Server=hostname;Port=port; Database=;Uid=xxxx;Pwd=pwd;AllowLoadLocalInfile=true;allowPublicKeyRetrieval=true;Connect Timeout=120";
                using (var conn = new MySqlConnection(connStr))
                using (MySqlCommand cancellableCommand = new MySqlCommand(sql, conn))
                {
                    cancellableCommand.CommandTimeout = 7200;

                    conn.Open();
                    return cancellableCommand.ExecuteNonQuery();
}```

**Expected behavior**
I would expect to procedure to run as long as it runs below 2 hours(Command timeout)

**Additional context**
Add any other context about the problem here.

erdemyalcn avatar May 08 '24 12:05 erdemyalcn

According to https://stackoverflow.com/q/78448752/23633, this also happens with MySql.Data. Seems like a server-side issue, not a client library problem.

bgrainger avatar May 08 '24 15:05 bgrainger