Description:
I am using ASP.Net application to connect to MySQL database. I am using C# to develop my web pages and using .Net Connector version 6.9.9.
This issue happening only on my Production environment. After application pool recycle, first connection to my database is failing with following error. I verified other bugs with same error but none of them are similar to my error. As I mentioned first connection for a given connection string fails after application pool recycle. Subsequent connections work fine.
I tried the Ping method. It didn't resolve issue.
Current revering the client back to 6.4.3 to resolved issue. But we want to use latest version of client libraries.
Exception details:
MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host 'PCMUXDS0003N001' for user 'coadminauto' 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: Attempted to read past the end of the 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.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at RusticiSoftware.ScormContentPlayer.DataHelp.DataHelper.CreateCommand(String statement)
at RusticiSoftware.ScormContentPlayer.DataHelp.DataHelper.Execute(String sql, ArrayList parameters, Func`2 result, Func`2 modifySql)
at RusticiSoftware.ScormContentPlayer.DataHelp.DataHelper.ExecuteSQLReturnDbRows(String sql, ArrayList parameters, Int32 pageSize, Int32 pageNum)
at RusticiSoftware.ScormContentPlayer.DataHelp.DataHelper.ExecuteSQLReturnDbRows(String sql, ArrayList parameters)
at RusticiSoftware.ScormContentPlayer.Logic.DataAccess.LoggingDataHelperWrapper.ExecuteSQLReturnDbRows(String sql, ArrayList parameters)
at RusticiSoftware.ScormContentPlayer.Logic.DataAccess.Schema.Discovery.MySqlSchemaDiscovererImplementation.GetTableNames()
at RusticiSoftware.ScormContentPlayer.Logic.DataAccess.Schema.Discovery.SchemaDiscoverer.Discover(Boolean filterUnrecognizedTables)
at RusticiSoftware.ScormContentPlayer.Logic.Upgrade.SchemaUpgradeEnvironment.LoadActualSchema()
at RusticiSoftware.ScormContentPlayer.Logic.Upgrade.SchemaUpgradeEnvironment.get_ActualSchema()
at RusticiSoftware.ScormContentPlayer.Logic.Upgrade.Phases.CreateMissingTablesPhase.Execute(UpgradeFacilities facilities)
at RusticiSoftware.ScormContentPlayer.Logic.Upgrade.UpgradeExecutor.Execute(UpgradeFacilities facilities)
How to repeat:
try
{
using (MySqlConnection conn = new MySqlConnection(strSystemConnectionString))
{
if (!conn.Ping())
{
conn.Open();
}
using (MySqlCommand cmd = new MySqlCommand("SELECT 1 FROM EngineTenant WHERE 1<>1", conn))
{
cmd.ExecuteNonQuery();
}
}
}