From b7d186d893c0fd0ef18bac9aa0a0907b23cbe415 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 30 Jul 2021 14:04:28 +0200 Subject: [PATCH] BUG/MINOR: poll: fix abnormally high skip_fd counter The skip_fd counter that is incremented when a migrated FD is reported was abnormally high in with poll. The reason is that it was accounted for before preparing the polled events instead of being measured from the reported events. This mistake was done when the counters were introduced in 1.9 with commit d80cb4ee1 ("MINOR: global: add some global activity counters to help debugging"). It may be backported as far as 2.0. (cherry picked from commit 177119bb110123b8b7510b93a77f07cc210af26c) Signed-off-by: Willy Tarreau (cherry picked from commit 2565905728d65bc31b4be20e0629cb4c5299d9b8) Signed-off-by: Willy Tarreau --- src/ev_poll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ev_poll.c b/src/ev_poll.c index 9f3d992..3062277 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -188,7 +188,6 @@ static void _do_poll(struct poller *p, int exp, int wake) } if (!(fdtab[fd].thread_mask & tid_bit)) { - activity[tid].poll_skip_fd++; continue; } @@ -233,6 +232,11 @@ static void _do_poll(struct poller *p, int exp, int wake) continue; } + if (!(fdtab[fd].thread_mask & tid_bit)) { + activity[tid].poll_skip_fd++; + continue; + } + n = ((e & POLLIN) ? FD_EV_READY_R : 0) | ((e & POLLOUT) ? FD_EV_READY_W : 0) | ((e & POLLRDHUP) ? FD_EV_SHUT_R : 0) | -- 1.7.10.4