为什么 Quartz .NET 3.0.7 调度程序挂起 DB 不可用错误

Why does Quartz .NET 3.0.7 scheduler hangs on DB unavailable error

我在 C# 控制台应用程序(运行 作为 windows 服务)中遇到一个非常简单的非集群石英服务器的问题。它包括一个单一的调度程序,从单一数据库读取和写入,这意味着同一组“qrtz_*”表。 偶尔,主要是周末晚上,我所在的公司做DB备份和一般维护时,我设置的scheduler listener抛出

    QuartzSchedulerListener

Scheduler Error -> MESSAGE: An error occurred while scanning for the next trigger to fire.

Couldn't acquire next trigger: Fatal error encountered during command execution.

at Quartz.Impl.AdoJobStore.JobStoreSupport.d__229.MoveNext() in C:\projects\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 2688 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Quartz.Impl.AdoJobStore.JobStoreSupport.d__262`1.MoveNext() in C:\projects\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 3816 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Quartz.Impl.AdoJobStore.JobStoreSupport.d__262`1.MoveNext() in C:\projects\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 3831 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Quartz.Impl.AdoJobStore.JobStoreSupport.d__228.MoveNext() in C:\projects\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 2542 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Quartz.Core.QuartzSchedulerThread.d__28.MoveNext() in C:\projects\quartznet\src\Quartz\Core\QuartzSchedulerThread.cs:line 262

我假设由于 DB 暂时不可用。

然后,有时,它只是挂起并停止执行任何触发器 - 它不会更新触发器 NEXT_FIRE_TIME,除了重新启动控制台应用程序(重新配置调度程序并重新启动它)之外,我无能为力。

我已经尝试增加调度程序配置连接字符串中的 dbCOmmandTimeout,但它看起来像是陷入了某种死锁。

PS:我有一个类似的设置,一组来自多个数据库的 quartz 2.6.1 调度程序 reading/writing。他们在数据库维护方面遇到了同样的错误,但在 activity.

一年多的时间里他们从未停止过

我 运行 没有想法,请告诉我是否有人遇到过这种情况。

谢谢

我们在 Quartz 版本 < 3.1 时遇到了同样的问题。有一个更新日志:https://github.com/quartznet/quartznet/blob/main/changelog.md

我认为您必须将 Quartz 至少更新到 3.1,其中一些关于数据库不可用的死锁问题已得到修复:

There is also a very important bug fix present for lock handling on retries. There was a possibility for a deadlock in database lock handling in some situations.

希望它对我有所帮助。