-
Notifications
You must be signed in to change notification settings - Fork 797
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
epoll_wait with event_fd does not support EPOLLET mode #2462
Comments
Okay, with effort I'm seeing it. Without
On WSL you only get the first |
Yes. Thanks for your reply. |
I gather from man epoll_wait(7) that any write (ie change) is considered a new "edge".
That said, NGINX doesn't seem to be following the "suggested way":
The test case doesn't follow (ii). Hopefully it's an easy fix. Good catch. Maybe it unblocks some unrelated stuff. |
I guess the reason of Nginx does not "read untill return EAGAIN" is performance. The read(2) is a system call which has performance overhead. Since the "write(event_fd, 1)" is just use for wake up the epoll_wait, the following read(2) is useless. In my first post, I said "I do not know if it is a bug of epoll_wait() or eventfd()". For normal fd, for example, socket, should keep read till got EAGAIN, but for eventfd, the read() is useless in most of scenario. |
You're absolutely right. Events don't have to be "drained" like a real pipe. Arguably the whole point is not having to do the read. Thanks for sharing, because I learned something. |
@huyuguang - Thanks for the detailed report and explanation. @Brian-Perkins as submitted a fix for this and should make it's way to the Insider build soon. |
@Brian-Perkins - Very thanks, please comment here if it is fixed. My work heavily rely on WSL. |
This should be fixed in the Insider build 17017. |
Very thanks! |
windows 10.0.15063, x64.
4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
I do not know if it is a bug of epoll_wait() or eventfd(), I wrote a demo code to prove it.
The code works fine in true linux, but not working in WSL.
If I add #define READ_TEST, the code works in WSL.
It seems that WSL does not implement EPOLLET correctly.
The text was updated successfully, but these errors were encountered: