Re: accept()ing socket connections with level triggered epoll

From: Davide Libenzi
Date: Wed Apr 26 2006 - 17:14:31 EST


On Wed, 26 Apr 2006, kyle@xxxxxxx wrote:

I think I may have found a bug in Linux's implementation of epoll. My
program creates a server socket that listens for incoming SOCK_STREAM
connections. It uses epoll to wait for notification of a new connection
(and also to handle the client sockets). While the client sockets use edge
triggered epoll, for performance reasons, the server socket uses level
triggered epoll.

I have found that when I open connections to my program very quickly, it is
sometimes possible to call accept more than once before reaching the point
where no more connections are available and EAGAIN is returned. If I return
to epoll_wait without accepting all of the available connections, I should
immediately be notified that a read is still available on the server socket,
since I am using level triggered epoll for that descriptor (at least that is
my understanding of how all of this is supposed to work ;). However, epoll
does not make this notification. Even if the program accepts further
incoming connections, the missed connection is never accepted, and
eventually times out on the client side.

Kernel version is 2.6.9. I can provide test code if needed.

Correct, if it's LT you have to get the event because before returning from epoll_wait(), the event is automatically re-armed if f_op->poll() returns it. Can you post the *minimal* test code for this case?



- Davide


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/