Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
erdemyalcn opened this issue May 8, 2024 · 1 comment

Comments

@erdemyalcn
Copy link

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.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.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.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.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.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.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.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.
@bgrainger
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants