Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
EventMachine relies on the fact that when close(fd)
is called that the fd is removed from any
epoll event queues.
However, this is not always the behavior of close(fd)
See man 4 epoll Q6/A6 and then consider what happens
when using pipes with eventmachine.
(As is often done when communicating with a subprocess)
The pipes end up looking like:
ls -l /proc//fd
...
lr-x------ 1 root root 64 2011-08-19 21:31 3 -> pipe:[940970]
l-wx------ 1 root root 64 2011-08-19 21:31 4 -> pipe:[940970]
This meets the critera from man 4 epoll Q6/A4 for not
removing fds from epoll event queues until all fds
that reference the underlying file have been removed.
If the EventableDescriptor associated with fd 3 is deleted,
its dtor will call EventableDescriptor::Close(),
which will call ::close(int fd).
However, unless the EventableDescriptor associated with fd 4 is
also deleted before the next call to epoll_wait, events may fire
for fd 3 that were registered with an already deleted
EventableDescriptor.
Therefore, it is necessary to notify EventMachine that
when an EventableDescriptor is closing so that it can
remove it from the event loop.