dotnetcore / FreeSql

🦄 .NET aot orm, C# orm, VB.NET orm, Mysql orm, Postgresql orm, SqlServer orm, Oracle orm, Sqlite orm, Firebird orm, 达梦 orm, 人大金仓 orm, 神通 orm, 翰高 orm, 南大通用 orm, 虚谷 orm, 国产 orm, Clickhouse orm, DuckDB orm, TDengine orm, QuestDB orm, MsAccess orm.
https://dotnetcore.github.io/FreeSql/
MIT License
4.11k stars 858 forks source link

程序运行过程中,偶发抛出Status unavailable, waiting for recovery. Authentication to host 'localhost' failed. #1897

Open LucasYao93 opened 3 weeks ago

LucasYao93 commented 3 weeks ago

问题描述及重现代码:

程序运行过程中,偶发的抛出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

数据库版本

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

2881099 commented 3 weeks ago

.UseAdoConnectionPool(true)

LucasYao93 commented 3 weeks ago

.UseAdoConnectionPool(true)

感谢回复,能否帮忙解答下,是什么原因造成的吗?

2881099 commented 2 weeks ago

字面理解就好,物理连接问题。这个问题freesql链接池背锅已久,意思让你们用ado.net链接池。

LucasYao93 commented 2 weeks ago

字面理解就好,物理连接问题。这个问题freesql链接池背锅已久,意思让你们用ado.net链接池。

请问下,这个背锅,背的是谁的锅?