Skip to content

Track armed events in muxnotes closely #295

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

Merged
merged 1 commit into from
Sep 4, 2017
Merged

Track armed events in muxnotes closely #295

merged 1 commit into from
Sep 4, 2017

Conversation

MadCoder
Copy link
Contributor

This fixes issues around resuming or re-registering file-descriptors with
a previously triggered EPOLLONESHOT event.

Signed-off-by: Pierre Habouzit phabouzit@apple.com
Fixes: SR-5759

@MadCoder
Copy link
Contributor Author

@swift-ci please test

@MadCoder
Copy link
Contributor Author

I'd appreciate a review from someone, @weissi (who is on vacation atm) has indepdently checked that it fixes SR-5759 for him.

the problem with epoll is that what is two different filters in the kevent world (EVFILT_READ/EVFILT_WRITE) is really a single one in epoll.

the multiplexing code which is a simplified version of the kevent one assumes that the first source that is resumed, resumes the multiplexing note, and that delivery disables it fully. However this is not quite how it works, we need to be able to do partial resumes/disarm of EPOLLIN and EPOLLOUT independently as all write sources of a given fd could be suspended while read sources are active and vice versa.

@MadCoder
Copy link
Contributor Author

Note: this is slated for swift4 too

@dgrove-oss
Copy link
Contributor

was out on vacation last week; will take a look at this tomorrow (unburying from other stuff today). Sorry for the delay.

Copy link
Contributor

@jblache jblache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

No regression against our codebase.

@MadCoder
Copy link
Contributor Author

@dgrove-oss no worries, this isn't even a day old ;) I'll wait for you to have a look then.

Copy link
Contributor

@dgrove-oss dgrove-oss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix makes sense to me and generally looks good. It just needs one small tweak to compile with the additional compilation warnings enabled when using CMake. The type of the local variable filter in _dispatch_muxnote_create needs to be updated to match the change of du_filter from intt_16 to intt_8. Patch below:

diff --git a/src/event/event_epoll.c b/src/event/event_epoll.c
index 6e4c29a..323772c 100644
--- a/src/event/event_epoll.c
+++ b/src/event/event_epoll.c
@@ -151,7 +151,7 @@ _dispatch_muxnote_create(dispatch_unote_t du, uint32_t events)
        dispatch_muxnote_t dmn;
        struct stat sb;
        int fd = (int)du._du->du_ident;
-       int16_t filter = du._du->du_filter;
+       int8_t filter = du._du->du_filter;
        bool skip_outq_ioctl = false, skip_inq_ioctl = false;
        sigset_t sigmask;

This fixes issues around resuming or re-registering file-descriptors with
a previously triggered EPOLLONESHOT event.

Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Fixes: SR-5759
@MadCoder MadCoder merged commit 70ce56b into master Sep 4, 2017
ktopley-apple pushed a commit that referenced this pull request Dec 6, 2018
Track armed events in muxnotes closely

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
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 this pull request may close these issues.

5 participants