程序运行过程中,偶发的抛出Status unavailable, waiting for recovery. Authentication to host 'localhost' failed. 后自动恢复。
数据库连接信息:
Server=localhost;Port=3306;Database=epams;Uid=root;Pwd=root;Charset=utf8mb4;Min Pool Size=50;Max Pool Size=200;
以下是堆栈信息
堆栈信息
2024-10-08 10:25:55,657 [RDT20240929135801] ERROR Wayeal.EPAMS.AnalysisService.RealDataWorkThread - RealDataWorkThread throw message. 【主库】Status unavailable, waiting for recovery. Authentication to host 'localhost' failed.
System.Exception: 【主库】Status unavailable, waiting for recovery. Authentication to host 'localhost' failed.
---> System.Exception: 【主库】Status unavailable, waiting for recovery. Authentication to host 'localhost' failed.
---> System.Security.Authentication.AuthenticationException: Authentication to host 'localhost' failed.
at MySql.Data.Common.Ssl.StartSSL(Stream& baseStream, Encoding encoding, String connectionString)
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 System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at FreeSql.MySql.MySqlConnectionPoolPolicy.OnGetAsync(Object1 obj) --- End of inner exception stack trace --- at FreeSql.Internal.ObjectPool.ObjectPool1.GetFree(Boolean checkAvailable)
at FreeSql.Internal.ObjectPool.ObjectPool1.GetAsync() at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultipleAsync(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Func3 fetchHandler, Action2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken) --- End of inner exception stack trace --- at FreeSql.Internal.CommonProvider.AdoProvider.LoggerException(IObjectPool1 pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, Boolean isThrowException)
at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultipleAsync(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Func3 fetchHandler, Action2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken)
at FreeSql.Internal.CommonProvider.Select0Provider`2.ToListAfPrivateAsync(String sql, GetAllFieldExpressionTreeInfo af, ReadAnonymousTypeOtherInfo[] otherData, CancellationToken cancellationToken)
at Wayeal.EPAMS.Infrastructure.Repositories.DeviceRepository.GetListAsync(Int32 skipCount, Int32 maxResultCount) in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\02_Infrastructure\Wayeal.EPAMS.Infrastructure\Repositories\DeviceRepository.cs:line 33
at Wayeal.EPAMS.ConfigurationCenterService.Domains.DeviceDomainService.GetListAsync(Int32 skipCount, Int32 maxResultCount) in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\08_ConfigurationCenter\Wayeal.EPAMS.ConfigurationCenterService\Domains\DeviceDomainService.cs:line 61
at Wayeal.EPAMS.AnalysisService.RealDataWorkThread.GenerateWorkParameterAsync(IServiceScope scope, DateTime timePoint) in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\11_AnalysisService\Wayeal.EPAMS.AnalysisService\RealDataWorkThread\RealDataWorkThread.cs:line 96
at Wayeal.EPAMS.AnalysisService.RealDataWorkThread.RunningAsync() in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\11_AnalysisService\Wayeal.EPAMS.AnalysisService\RealDataWorkThread\RealDataWorkThread.cs:line 70
at Wayeal.EPAMS.AnalysisService.RealDataWorkThread.RunningAsync() in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\11_AnalysisService\Wayeal.EPAMS.AnalysisService\RealDataWorkThread\RealDataWorkThread.cs:line 75
问题描述及重现代码:
程序运行过程中,偶发的抛出Status unavailable, waiting for recovery. Authentication to host 'localhost' failed. 后自动恢复。
数据库连接信息: Server=localhost;Port=3306;Database=epams;Uid=root;Pwd=root;Charset=utf8mb4;Min Pool Size=50;Max Pool Size=200;
以下是堆栈信息 堆栈信息 2024-10-08 10:25:55,657 [RDT20240929135801] ERROR Wayeal.EPAMS.AnalysisService.RealDataWorkThread - RealDataWorkThread throw message. 【主库】Status unavailable, waiting for recovery. Authentication to host 'localhost' failed. System.Exception: 【主库】Status unavailable, waiting for recovery. Authentication to host 'localhost' failed. ---> System.Exception: 【主库】Status unavailable, waiting for recovery. Authentication to host 'localhost' failed. ---> System.Security.Authentication.AuthenticationException: Authentication to host 'localhost' failed. at MySql.Data.Common.Ssl.StartSSL(Stream& baseStream, Encoding encoding, String connectionString) 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 System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken) --- End of stack trace from previous location --- at FreeSql.MySql.MySqlConnectionPoolPolicy.OnGetAsync(Object
1 obj) --- End of inner exception stack trace --- at FreeSql.Internal.ObjectPool.ObjectPool
1.GetFree(Boolean checkAvailable) at FreeSql.Internal.ObjectPool.ObjectPool1.GetAsync() at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultipleAsync(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Func
3 fetchHandler, Action2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken) --- End of inner exception stack trace --- at FreeSql.Internal.CommonProvider.AdoProvider.LoggerException(IObjectPool
1 pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, Boolean isThrowException) at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultipleAsync(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Func3 fetchHandler, Action
2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken) at FreeSql.Internal.CommonProvider.Select0Provider`2.ToListAfPrivateAsync(String sql, GetAllFieldExpressionTreeInfo af, ReadAnonymousTypeOtherInfo[] otherData, CancellationToken cancellationToken) at Wayeal.EPAMS.Infrastructure.Repositories.DeviceRepository.GetListAsync(Int32 skipCount, Int32 maxResultCount) in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\02_Infrastructure\Wayeal.EPAMS.Infrastructure\Repositories\DeviceRepository.cs:line 33 at Wayeal.EPAMS.ConfigurationCenterService.Domains.DeviceDomainService.GetListAsync(Int32 skipCount, Int32 maxResultCount) in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\08_ConfigurationCenter\Wayeal.EPAMS.ConfigurationCenterService\Domains\DeviceDomainService.cs:line 61 at Wayeal.EPAMS.AnalysisService.RealDataWorkThread.GenerateWorkParameterAsync(IServiceScope scope, DateTime timePoint) in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\11_AnalysisService\Wayeal.EPAMS.AnalysisService\RealDataWorkThread\RealDataWorkThread.cs:line 96 at Wayeal.EPAMS.AnalysisService.RealDataWorkThread.RunningAsync() in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\11_AnalysisService\Wayeal.EPAMS.AnalysisService\RealDataWorkThread\RealDataWorkThread.cs:line 70 at Wayeal.EPAMS.AnalysisService.RealDataWorkThread.RunningAsync() in D:\repository\EPAMS\Wayeal.EPAMS.Server\src\11_AnalysisService\Wayeal.EPAMS.AnalysisService\RealDataWorkThread\RealDataWorkThread.cs:line 75数据库版本
Mysql.5.7.44
安装的Nuget包
FreeSql 3.2.815 MySql.Data 8.0.30 FreeSql.DbContext 3.2.815 FreeSql.Provider.MySql 3.2.815
net core
Net6.0