-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Always re-register epoll descriptor. #71
Conversation
18b7c2c
to
c0cf5f7
Compare
c0cf5f7
to
2610960
Compare
@Math2 this is kind of disappointing but maybe unavoidable. |
(https://stackoverflow.com/a/26547388) Predictably, Linux does the same thing as it does for select(2). From the manual page:
And from the select(2) page:
The tl;dr; is "don't do it":
|
I have been considering introducing a |
https://idea.popcount.org/2017-02-20-epoll-is-fundamentally-broken-12/ |
Yeah... seems like there's no other way. As far as I can tell. It's either one-shot-like design, or the selector needs to know about close()s. I don't see how else it could do the right thing otherwise. The selector just wouldn't have enough information. Most of those event mechanisms, apparently they were designed with application-specific event loops in mind. Not something generic that can be shared by different modules in the same process. That's forcing to design the selector as more of a layer that interposes itself between the event mechanism and the user code. Just so that it can know how FDs are being managed and do what the mechanism expects. It would have been so much better if the mechanisms themselves were more "FD-oriented" instead (because that's what user code actually deals with, not the underlying kernel objects). Anyway, if there's an If the selector could know for sure when an IO operation yielded an |
I slept on it and now I have a better idea, I'll make a PR to see if it's viable. |
What do you think of 2852d4f? |
There is one more idea I had: when all waiting fibers are cancelled due to |
Nice. Good idea. I hadn't thought of that. We can assume that the FD has been closed and re-opened if we get passed a different IO object for the same FD... I did some stress testing and it seems to work fine. Can IO_Event_Selector_EPoll_Descriptor structs be traversed by the GC? I think it would have to be to be 100% correct. But, the odds of the exact same IO object address getting recycled at exactly the wrong time must be pretty damn small.
That would be for when IO is done through the selector with |
You are correct, if we are going to use it, we should retain it via GC. We have to carefully consider when it goes out of scope, but that should be okay. |
#69 introduced a failing test case.
File descriptors may be reused. Caching based on descriptor can therefore cause missing registrations.
Types of Changes
Contribution