-
Notifications
You must be signed in to change notification settings - Fork 735
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
Conditional reregistering interests in IoSourceState
with mio_unsupported_force_poll_poll
poll(2) based on IO operation result
#1809
Comments
I ported Mio to Fuchsia in #1811. Hope that makes things a bit easier.
Per Mio's documentation in https://docs.rs/mio/latest/mio/struct.Poll.html#readiness-operations. Mio's I/O types need to be "drained", that means calling the I/O method (e.g. read) in a loop until it returns Tokio has done this wrong in the past where it assumed that all Unix implementations had the in-kernel reregister on short read behaviour. In this if you search for |
Thanks for that. I'll prepare a PR to Fuchsia once
What do you mean with "in the past"? Should this be "fixed"? My testes are done with Tokio 1.32.1 which is the currently integrated version in Fuchsia. Should be easy to update test wise. I checked So - I understand that my workaround just hides the missing reregistration from Tokio. |
See tokio-rs/tokio#5866 and tokio-rs/tokio#5881.
I'm not sure if it's still in but the code added in tokio-rs/tokio#5881 would be it.
Pretty much. Tokio incorrectly (for the |
conclusion for me is that I need to set Thanks @Thomasdezeeuw |
It shouldn't be needed, but that is being fixes in tokio-rs/tokio#5866, see tokio-rs/tokio#5866 (comment) and comments after. |
Hello,
I'm playing mio (as dependency of Tokio) on Fuchsia. Since Fuchsia lacks
epoll
support, I opted to usemio_unsupported_force_poll_poll
. Sidenote: The waker implementation viaeventfd(2)
appears to be functioning correctly on Fuchsia. Buildingmio
for Fuchsia required some minor adjustments, primarily extendingcfg
gates in various places, such as tcp.rs.My test setup includes a TCP (IPv6) listener that spawns a task for each connection, echoing data via
tokio::io::copy
. The client is eithersocat
or aTcpStream
in another task. I observed that the initial accept and the first data transaction work fine, but subsequent communication stalls.The issue appears to be that the interests in the poll implementation are cleared whenever a poll returns
revents
, as seen here.I compared the behavior on an x86 Linux system using the same test and analyzed the logs. The difference is that on
Linux
, the interest of a file descriptor (fd
) is cleared and re-registered if the I/O operation returnsWouldBlock
as shown here.On Fuchsia, however, the I/O operation returns (in most cases)
Ok(..)
, and the interest is never re-registered, leading to the communication stall. Could this happen on Linux as well?What's the rationale behind reregistering only on
WouldBlock
? My assumption is that e.g aread
could returnOk(..)
and thefd
should be reregistered afterwards. I didn't dig into the Linux side yet.Testwise I removed
if let Err(..)
condition around the reregistering and successfully smoke tested some example Tokio code and themio
tcp_server
example .I can share the modifications I did to
mio
. Same for updates on the integration ofmio
in Fuchsia that enablenet
andos-poll
(+ Tokio features) if needed.I know that
mio_unsupported_force_poll_poll
. I know thatFuchsia
is unspported. :-)Any thoughts on this?
Thanks! @flxo
The text was updated successfully, but these errors were encountered: