On Wed, Jun 13, 2012 at 8:37 AM, Lauri Kasanen <[email protected]> wrote:
> Hi
>
> epoll_del must be called to avoid false events, for more info see the patch.
>
> Without this patch, the CGI plugin was really unstable - you would have file
> descriptors after successful open() be invalid etc.
>
Per epoll(7):
Q6 Will closing a file descriptor cause it to be removed from
all epoll sets
automatically?
A6 Yes, but be aware of the following point. A file descriptor is a
reference to an open file description (see open(2)). Whenever a
descriptor is duplicated via dup(2), dup2(2), fcntl(2) F_DUPFD, or
fork(2), a new file descriptor referring to the same open
file description
is created. An open file description continues to exist
until all file
descriptors referring to it have been closed. A file descriptor is
removed from an epoll set only after all the file
descriptors referring to
the underlying open file description have been closed (or
before if the
descriptor is explicitly removed using epoll_ctl(2)
EPOLL_CTL_DEL). This
means that even after a file descriptor that is part of an
epoll set has
been closed, events may be reported for that file
descriptor if other file
descriptors referring to the same underlying file
description remain open.
Initially Monkey core expect to do not fork() as is a performance
killer, so it trust in the kernel which remove the fd from the epoll
queue, avoiding a system call per request. Due to the nature of the
plugin a fork() is required and we face the issue described in the man
page of epoll, How much cost that extra system call ? I think that we
can consider to add an extra flag to the config structure indicating
that the plugin will perform fork() dup() or similar over the FD so
the core will take care of the same removal.
comments ?
> - Lauri
>
> _______________________________________________
> Monkey mailing list
> [email protected]
> http://lists.monkey-project.com/listinfo/monkey
>
--
Eduardo Silva
http://edsiper.linuxchile.cl
http://www.monkey-project.com
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey