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

WakerRegistrar mentioned in comment is not present #1728

Closed
psumbera opened this issue Dec 5, 2023 · 2 comments · Fixed by #1729
Closed

WakerRegistrar mentioned in comment is not present #1728

psumbera opened this issue Dec 5, 2023 · 2 comments · Fixed by #1729

Comments

@psumbera
Copy link
Contributor

psumbera commented Dec 5, 2023

https://github.com/tokio-rs/mio/blame/f6a20da1c81c2d56a78bc6f6832b9904b9215914/src/sys/unix/selector/poll.rs#L267

                        // Remove the interest which just got triggered
                        // the IoSourceState/WakerRegistrar used with this selector will add back
                        // the interest using reregister.
                        poll_fd.events &= !poll_fd.revents;

when I use mio within https://github.com/rust-lang/rustup on Solaris it does not reregister (and rustup doesn't download stuff)

Looking at IoSourceState (mentioned in the comment as well) it does reregistration just in case of error!?

https://github.com/tokio-rs/mio/blob/master/src/sys/unix/selector/poll.rs#L663

@jasta, where is WakerRegistrar and how is reregistration supposed to work?

@Thomasdezeeuw
Copy link
Collaborator

https://github.com/tokio-rs/mio/blame/f6a20da1c81c2d56a78bc6f6832b9904b9215914/src/sys/unix/selector/poll.rs#L267

                        // Remove the interest which just got triggered
                        // the IoSourceState/WakerRegistrar used with this selector will add back
                        // the interest using reregister.
                        poll_fd.events &= !poll_fd.revents;

when I use mio within https://github.com/rust-lang/rustup on Solaris it does not reregister (and rustup doesn't download stuff)

Looking at IoSourceState (mentioned in the comment as well) it does reregistration just in case of error!?

https://github.com/tokio-rs/mio/blob/master/src/sys/unix/selector/poll.rs#L663

This is to emulate edge triggers. We remove the interest when it's triggered. For example if we get a readable event we won't poll for it again until it's reregistered, which is what happens in IoSourceState.

@jasta, where is WakerRegistrar and how is reregistration supposed to work?

I believe it was renamed to WakerInternal:

pub struct WakerInternal {

@jasta
Copy link
Contributor

jasta commented Dec 6, 2023

Indeed, the comment must not have been updated after the big refactor. The logic that this is referring to is the call to reregister in the same file under IoSourceState::do_io. This happens through a wrapper around all I/O that checks for EWOULDBLOCK, which actually breaks in tokio for certain cases due to tokio-rs/tokio#5866.

I'll send up a PR to fix the comments though.

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

Successfully merging a pull request may close this issue.

3 participants