yuzd / Hangfire.HttpJob

httpjob for Hangfire,restful api for Hangfire,job调度与业务分离
https://github.com/yuzd/Hangfire.HttpJob/wiki
MIT License
634 stars 186 forks source link

Connect Timeout expired. All pooled connections are in use. #167

Closed Fixoo closed 2 years ago

Fixoo commented 2 years ago

环境

SDK:.NET6 window service 服务器:windows server 2019 数据库:mysql-8.0.26

错误信息

`日志名称: Application 来源: HangfireService 日期: 2022/8/10 0:11:17 事件 ID: 0 任务类别: 无 级别: 错误 关键字: 经典 用户: 暂缺 计算机: iZmja15lgrjqf6Z 描述: Category: Hangfire.Processing.BackgroundExecution EventId: 0

Execution Worker is in the Failed state now due to an exception, execution will be retried no more than in 00:05:00

Exception: MySqlConnector.MySqlException (0x80004005): Connect Timeout expired. All pooled connections are in use. ---> System.OperationCanceledException: The operation was canceled. at System.Threading.SemaphoreSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ConnectionPool.cs:line 142 at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/MySqlConnection.cs:line 848 at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 848 at MySqlConnector.MySqlConnection.OpenAsync(Nullable1 ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/MySqlConnection.cs:line 419 at MySqlConnector.MySqlConnection.Open() in //src/MySqlConnector/MySqlConnection.cs:line 365 at Hangfire.MySql.JobQueue.MySqlJobQueue.Dequeue(String[] queues, CancellationToken cancellationToken) at Hangfire.MySql.MySqlStorageConnection.FetchNextJob(String[] queues, CancellationToken cancellationToken) at Hangfire.Server.Worker.Execute(BackgroundProcessContext context) at Hangfire.Server.BackgroundProcessDispatcherBuilder.ExecuteProcess(Guid executionId, Object state) at Hangfire.Processing.BackgroundExecution.Run(Action`2 callback, Object state)

事件 Xml:

0 2 0 0x80000000000000 68136 Application iZmja15lgrjqf6Z Category: Hangfire.Processing.BackgroundExecution EventId: 0 Execution Worker is in the Failed state now due to an exception, execution will be retried no more than in 00:05:00 Exception: MySqlConnector.MySqlException (0x80004005): Connect Timeout expired. All pooled connections are in use. ---> System.OperationCanceledException: The operation was canceled. at System.Threading.SemaphoreSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 142 at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 848 at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 848 at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 419 at MySqlConnector.MySqlConnection.Open() in /_/src/MySqlConnector/MySqlConnection.cs:line 365 at Hangfire.MySql.JobQueue.MySqlJobQueue.Dequeue(String[] queues, CancellationToken cancellationToken) at Hangfire.MySql.MySqlStorageConnection.FetchNextJob(String[] queues, CancellationToken cancellationToken) at Hangfire.Server.Worker.Execute(BackgroundProcessContext context) at Hangfire.Server.BackgroundProcessDispatcherBuilder.ExecuteProcess(Guid executionId, Object state) at Hangfire.Processing.BackgroundExecution.Run(Action`2 callback, Object state) `
yuzd commented 2 years ago

看起来像是mysqlstorage里面的报错,这个我也没有什么经验 相比用mysql我是建议用sqlserver

Fixoo commented 2 years ago

感谢您回复信息。切换成sql server试试看