[master] 8822c84 Do not trigger on EPOLLPRI in the epoll waiter

Martin Blix Grydeland martin at varnish-software.com
Fri Apr 10 14:06:55 CEST 2015


commit 8822c846c868a73f0c72a3ba1059fe788b107987
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Fri Apr 10 11:30:40 2015 +0200

    Do not trigger on EPOLLPRI in the epoll waiter
    
    EPOLLPRI causes the waiter to report activity on a socket when there
    is OOB data available. Since HTTP does not make use of OOB the data is
    never read and the socket thus is always ready for read according to
    the waiter. This causes the waiter to continously assign the session
    to a worker only for the worker to find out there is no data sending
    it back to the waiter. This continues until the request timeout_idle
    has elapsed.
    
    This problem does no constitute a DOS attack vector as the linger
    timeout in the session SES_RxReq is still invoked, and this one does
    not trigger on PRI. So the worker sleeps on that poll for
    timeout_linger before sending the session back to the waiter, and
    eventually is dropped on timeout_idle.

diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index 0778d43..56987cd 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -74,7 +74,7 @@ vwe_inject(const struct waiter *w, struct waited *wp)
 		AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_MOD, wp->fd, &wp->ev));
 	else {
 		wp->ev.data.ptr = wp;
-		wp->ev.events = EPOLLIN | EPOLLPRI | EPOLLRDHUP;
+		wp->ev.events = EPOLLIN | EPOLLRDHUP;
 		if (wp != w->pipe_w)
 			wp->ev.events |= EPOLLONESHOT;
 		AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_ADD, wp->fd, &wp->ev));
@@ -88,7 +88,7 @@ vwe_eev(struct vwe *vwe, const struct epoll_event *ep, double now)
 
 	AN(ep->data.ptr);
 	CAST_OBJ_NOTNULL(sp, ep->data.ptr, WAITED_MAGIC);
-	if (ep->events & EPOLLIN || ep->events & EPOLLPRI) {
+	if (ep->events & EPOLLIN) {
 		Wait_Handle(vwe->waiter, sp, WAITER_ACTION, now);
 	} else if (ep->events & EPOLLERR) {
 		Wait_Handle(vwe->waiter, sp, WAITER_REMCLOSE, now);



More information about the varnish-commit mailing list