Giter VIP home page Giter VIP logo

Comments (8)

DoumanAsh avatar DoumanAsh commented on August 16, 2024 1

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.

jonhoo avatar jonhoo commented on August 16, 2024 1

I can confirm that tokio-rs/tokio#2221 indeed fixed this issue!

from async-timer.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

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.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

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.

jonhoo avatar jonhoo commented on August 16, 2024

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.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

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.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

Wait for tokio-rs/tokio#2222

from async-timer.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

Fixed by tokio and will be available in 0.2.12

from async-timer.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.