-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Deadlock occurs during shutdown #1178
Comments
snapshot#join 需要等待jobs的触发,而jobs的触发需要做完一次snapshot,而我应用已经下线了,不可能再去做snapshot,所以snapshot就不可能触发,导致直接hang死 |
NodeImpl的join会去等待snapshot的快照,而shutdown的时候,snapshot不可能去做了,业务线程全部关闭了,我snapshot 10分钟一次,等于起码得等10分钟后才能下线,这太奇怪了,由于raftgroupservice的shutdown行为是异步的,所以我才用join去等待下线,而不是直接暴力下线,导致主线程这里的join在等异步线程的join释放锁,而异步线程的join释放锁需要等snapshot做完 |
如果这确定是一个bug的话,我认为有2个解决方法 |
Describe the bug
可以看到jraft的groupshutdown是启动一个新的线程去shutdown,此时NodeImpl的shutdown后也会去执行join方法
然后业务线程等待这个结果时,join方法是携带了synchronized,导致shutdownhook线程因为拿不到nodeimpl的锁导致一直hang住,应用无法下线
Expected behavior
Actual behavior
Steps to reproduce
Minimal yet complete reproducer code (or GitHub URL to code)
Environment
java -version
):uname -a
):The text was updated successfully, but these errors were encountered: