-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
程序意外退出锁没有释放的问题 #50
Comments
目前这种基于数据库的分布式锁实现确实有这个不能释放的问题,简单的处理办法可以加一个后台扫描线程,把持有锁超过X时间的强制释放掉。 |
mysql的话可以加事务避免出现僵尸锁,测试过,拔网线和杀死worker都能避免,talk is cheap ,show my code:
|
你所发的邮件已收到,查阅后再回复!
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果在没有执行DabaseLock.Dispose()方法之前worker崩溃意外退出;
这样会导致schedulelocks中的status没有设置为0,也就是锁没有被释放,当再次启动worker会发现任务永远不会被调度,因为DabaseLock.TryGetLock获取不到锁。
目前我临时的解决方法是在管理后台点击【停止】按钮时将该任务的锁释放掉。博主有好的解决方案没?
The text was updated successfully, but these errors were encountered: