Comments (8)
yeah I'll check what PollEvented does, but there is definitely no read notification and yet tokio calls in the future.
So probably PollEvented registers more than read interest with mio
from async-timer.
I can confirm that tokio-rs/tokio#2221 indeed fixed this issue!
from async-timer.
Ok, so I know that tokio tends to do some spurious polls, but it should not be so often...
After wake up, you restart timer by updating to new timestamp and poll it...
Obviously mio would return that it is not ready, otherwise we would clear ready flag https://github.com/DoumanAsh/async-timer/blob/master/src/oneshot/timer_fd.rs#L165
Logically speaking I think I did everything I could, but in case of kevent and timerfd timers I depend on tokio to wake timer.
POSIX timer is using my own waker to wake once (by calling callback from signal)
Out of curiosity could you try the same with single threaded runtime?
I'll try to check tokio integration myself once I'll have time
P.s. interesting thing to point out is that I clear readiness only on read event, I wonder if it wakes up with non-read events? 😄
from async-timer.
Note to self: checked macOS, has the same problem.
Type of scheduler doesn't matter
Added prints to see when it is called:
SystemTime { tv_sec: 1579776488, tv_nsec: 546224000 } poll_next
timer not ready
SystemTime { tv_sec: 1579776488, tv_nsec: 546280000 } poll_next
timer not ready
SystemTime { tv_sec: 1579776488, tv_nsec: 546322000 } poll_next
timer not ready
SystemTime { tv_sec: 1579776488, tv_nsec: 548794000 } poll_next
timer ready
SystemTime { tv_sec: 1579776488, tv_nsec: 548882000 } yield
https://github.com/DoumanAsh/async-timer/blob/master/src/oneshot/kqueue.rs#L151 always not ready here
Which makes me wonder if tokio registered timer for write readiness.
Will need to check sources
from async-timer.
Hmm, I do remember having some odd issues with using PollEvented
back in the day, and then ended up moving to Registration
. I wonder if that might work here too?
from async-timer.
Conclusion: PollEvented
might register non-read interest so we should either not use it or work it around by removing non-read interests
from async-timer.
Wait for tokio-rs/tokio#2222
from async-timer.
Fixed by tokio and will be available in 0.2.12
from async-timer.
Related Issues (12)
- arm32: Invalid conversion from i32 to u32 HOT 1
- 1.0.0: Final rewrite
- tokio policy HOT 1
- Std AsyncIterator HOT 1
- thread 'tokio-runtime-worker' panicked at 'Assertion 'fd != -1' failed. OS error 24: Too many open files' HOT 4
- update tokio dependency HOT 2
- Investigate behavior of small timers on Apple platforms HOT 1
- The behavior of Interval HOT 10
- v1.0.0-beta.13 breaks on wasm32-unknown-unknown HOT 2
- Make Interval implement Stream HOT 1
- lots of errors for aarch64-linux-android HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-timer.