-
-
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
inserting a new item into a delay queue always waits for that new item even if the queue already contained earlier expiring items #1700
Comments
i can't seem to reproduce this in tests though - these two both pass: master:
v0.1.x:
i'm not super familiar with the structure of the test suite, though - am i doing anything wrong here? |
I can confirm this bug. It was added in tokio-timer 0.2.10. My example works fine with 0.2.9 Version
➜ cargo tree | grep tokio
PlatformLinux dell-inspiron 5.5.11-1-MANJARO #1 SMP PREEMPT Sat Mar 21 16:54:29 UTC 2020 x86_64 GNU/Linux also on armv7 with musl target. DescriptionI have create a separate repository that can be cloned to reproduce bug. Steps:
tokio-compat force to use at least 0.2.12 I don't know how much tokio::time is different between tokio-timer but can also be affected. |
tokio v 0.2 is also affected. |
ping @carllerche ^ |
I think this should already be fixed in 0.2 by #2285 |
I can confirm #2285 fix this for tokio v0.2. I have tried to modify last tokio-timer with this patch but it doesn't work for me. So this issue shouldn't be closed by this PR. It resolve problem for v0.2 but not for v0.1 |
When the queue was polled and yielded an index from the wheel, the delay until the next item was never updated. As a result, when one item was yielded from `poll_idx` the following insert erronously updated the delay to the instant of the inserted item. Fixes: #1700
@carllerche This resolved problem in tokio v0.2 Shouldn't this be still open since tokio v0.1 is still affected? |
I believe this can be closed now as 0.1 is no longer maintained. |
Version
tokio v0.1.22
Platform
Linux hush 5.3.7-arch1-1-ARCH #1 SMP PREEMPT Fri Oct 18 00:17:03 UTC 2019 x86_64 GNU/Linux
Subcrates
tokio::timer
Description
inserting items into a delay queue after it is already running causes the delay queue to not be woken up until the newly inserted item is ready, even if there were previously other items that would have woken up earlier. example code:
this code produces this output:
but if you comment out the
self.delay_queue.insert(10, std::time::Duration::from_secs(10));
line, you get this output as expected:The text was updated successfully, but these errors were encountered: