Skip to content
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

时间轮有并发问题,极端情况下丢失调度 #2877

Open
wangqingchengsg opened this issue Jun 2, 2022 · 7 comments
Open

时间轮有并发问题,极端情况下丢失调度 #2877

wangqingchengsg opened this issue Jun 2, 2022 · 7 comments

Comments

@wangqingchengsg
Copy link

image

Uploading image.png…

一个线程向时间轮添加,一个线程删除,并发问题

@wangqingchengsg
Copy link
Author

image

@cc-nnqt
Copy link

cc-nnqt commented Jun 16, 2022

这个代码确实是会有并发问题存在

@lanicc
Copy link

lanicc commented Jun 30, 2022

这里的并发问题,具体指什么呢?比如是使用的容器不具备线程安全性,还是某段操作不具备原子性

@lzj960515
Copy link

代码逻辑是会补偿1s之前的调度。就算在同一秒内,先remove,再push,丢失了这一次的调度,在下一秒同样可以补偿到上一秒丢失的调度。

如果还是没有补偿到,那么在下一个5s将会立即进行一次调度。

@yaokkkkk
Copy link

代码逻辑是会补偿1s之前的调度。就算在同一秒内,先remove,再push,丢失了这一次的调度,在下一秒同样可以补偿到上一秒丢失的调度。

如果还是没有补偿到,那么在下一个5s将会立即进行一次调度。

如果MisfireStrategy是不处理过期任务,还是会丢任务

@dingyaK
Copy link

dingyaK commented Feb 11, 2023

这里的确有问题

@yaokkkkk
Copy link

认真看了下无论MisfireStrategy是什么都会有问题,进缓存之前就更新了时间了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants