-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[#5536] tokio-util: fix panic in DelayQueue #5630
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hi @Darksonn - do you have an ETA for the next tokio-util release? |
If you submit a release PR for tokio-util, then I can make a release today. (Example in #5442.) Otherwise, I can make a release early next week. |
I won't have space to make that PR, but a release early next week would be great- thanks. |
Fixes: #5536
Motivation
Experienced an upstream service which had been running for over 2 years to have an outage due to this bug.
This was also a bug in tokio up to and including version 0.3.4.
Solution
I copied the fix in tokio, which fudges any items which have timers which would logically go into the top+1 level into the top level.
This means that you can insert an item into "the past" (if the time since the queue has been alive is in the top most level, and the item has been fudged into the top level too, and occupies an earlier slot). We handle this by bumping up the corresponding timer by the level range.
Added test to check that inserting to a delayqueue that has existed for more than the 2^36 ms doesn't panic.
Cargo fmt ran.