我有带有Hangfire 1.6.2和Hangfire.MySql.NetCore 1.0.7的asp.net core 2.1应用程序。有一项工作是,当应用程序第三次或第四次入队时,应用程序将抛出此异常并关闭; An unhandled exception of type 'System.StackOverflowException' occurred in Hangfire.AspNetCore.dll
目前正在排队。其他后台作业也遵循这种模式。作业成功入队,并且在将作业激活到处理队列时会引发异常。这是在引发异常之前和激活作业的同时出现的日志。这暗示了分布式锁定的一些问题;
Hangfire.MySql.MySqlDistributedLock:Trace: MySqlDistributedLock resource=JobQueue, timeout=00:00:30
Hangfire.MySql.MySqlDistributedLock:Trace: Release resource=JobQueue
Hangfire.MySql.MySqlDistributedLock:Trace: MySqlDistributedLock resource=job:16:state-lock, timeout=00:15:00
Hangfire.MySql.MySqlDistributedLock:Trace: Acquire resource=job:16:state-lock, timeout=00:15:00
Hangfire.MySql.MySqlWriteOnlyTransaction:Trace: SetJobState jobId=16
Hangfire.MySql.MySqlWriteOnlyTransaction:Trace: PersistJob jobId=16
Hangfire.MySql.MySqlDistributedLock:Trace: Release resource=job:16:state-lock
An unhandled exception of type 'System.StackOverflowException' occurred in Hangfire.AspNetCore.dll
答案 0 :(得分:0)
在程序包管理器控制台中,请运行以下命令:
Install-Package HangFire.Core -Version 1.6.21