-
Notifications
You must be signed in to change notification settings - Fork 744
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
Migrate to I/O safety traits #1588
Comments
At This would be especially bad if I/O-safety is added to |
This is tough, because you can't exactly just use something semantically analogous to Arc, as you end up leaking Fds rather than dangling them. I don't think there's a good way od solving this without basically having the poller own the sockets, or the sockets share state with poll to allow for deregistration on drop. |
For Mio at least However how do the I/O safety traits change this? I'm pretty this already the case with (Mio's) I/O types already.
I don't think it really changes much from Mio's perspective, it's currently already required to deregister resource properly.
I rather keep the I/O type just the fds, especially on epoll/kqueue where this isn't a problem. |
didn't epoll also have a problem with this when file descriptors get cloned (or used in forked processes)? |
Unfortunately
Right now it's just a correctness issue, but now with I/O safety it becomes a soundness issue, meaning that
Ditto as above. |
Doesn't that discussion reach the same conclusion that I did? That closing the fd without deregisting isn't an issue, even in case of duplication, because kqueue works with file descriptors (user space) not on file descriptions (kernel space). For epoll it's the opposite as it does work on file descriptions, so duplicating a file descriptor means you'll still get events for it until both fds (and thus the file description) are deregistered or closed.
Where does the unsoundness come from?
Yes, also see above, but the worst of it is that we get events for a |
which has the added side effect that we can't deregister it to fix the problem in that case also. but overall I don't think the differences between the models matter much here, because it causes issues regardless of that (and potential pre-denial-of-service like states where we are bombarded with events or errors which we can't fix, causing unnecessary load which can't be fixed without reinitializing the entire reactor and re-registering all actually wanted fds(handles again. |
Note that I don't think Mio is not susceptible to those kind of DOS attacks since we use edge triggers, in the worst case we get a single event, maybe two if we get one for readable and another for closed/error. |
See rust-lang/rust#87074 and sunfishcode/io-lifetimes#38.
The text was updated successfully, but these errors were encountered: