Description:
We recently switch from
MySQL Server 5.1.54 plus MySQL Connector.NET 6.1.3
to
MySQL Server 5.6.25 plus MySQL Connector.NET 6.9.3
The Server is running on Windows Server 2012 x64
The Clients are running a Windows Forms application from different operating systems (Windows 7 (x86, x64), Windows 8 (x86, x64), Windows Server 2008 R2 (x64))
This setup worked stable for many years but since the update the clients on terminal servers get random EndOfStreamExceptions.
We have two terminal servers with about 20 clients each.
The application uses pooling and follows the pattern
- create connection
- open connection
- query database
- close connection
so it creates a lot connections. I would say about 10 per client per minute.
Since the update I get many stacktraces on totally different code locations that all look like this
MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host 'server' for user 'user' using method 'mysql_native_password' failed with message: Reading from the stream has failed. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.EndOfStreamException: Failed to read past end of stream.
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlConnection.Open()
This is toally random and for 40 users that create about 200.000 connections per day (40 users * 10 connections per minute * 60 minutes * 8 hours = 192000) I have 20-30 errors per day.
What makes me suspcious is all these stacktraces are from the terminal servers but I have about 30 users from windows clients and not a single EndOfStreamException.
Both terminal servers and the database server are vms on a VMware 5.5 host
How to repeat:
My Server is pretty much a default install with
- max allowed package size = 10M
- skip-name-resolve
Create many new MySqlConnection with on a Windows Server 2008 R2 terminal server
connectionstring = "Server='server';Port=3306;Database='schema';Uid='user';Password='pass';Default Command Timeout=30;CharSet=utf8;Connect Timeout=60;Allow Zero Datetime=false;Pooling = true;";
var connection = new MySqlConnection(connectionString);
connection.Open();
Suggested fix:
Don't throw exception