]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: listener: make sure we don't pick stopped threads
authorWilly Tarreau <w@1wt.eu>
Wed, 13 Mar 2019 14:03:53 +0000 (15:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 13 Mar 2019 14:03:53 +0000 (15:03 +0100)
Dragan Dosen reported that after the multi-queue changes, appending
"process 1/even" on a bind line can make the process immediately crash
when delivering a first connection. This is due to the fact that I
believed that thread_mask(mask) applied the all_threads_mask value,
but it doesn't. And in case of even/odd the bits cover more than the
available threads, resulting in too high a thread number being selected
and a non-existing task to be woken up.

No backport is needed.

src/listener.c

index 4299761e5ba141860b19704e5e3d832b95fa32bd..a023e59167b0231579e931a6ed4fdbff5fda8ee9 100644 (file)
@@ -845,7 +845,7 @@ void listener_accept(int fd)
                next_actconn = 0;
 
 #if defined(USE_THREAD)
-               mask = thread_mask(l->bind_conf->bind_thread);
+               mask = thread_mask(l->bind_conf->bind_thread) & all_threads_mask;
                if (atleast2(mask) && (global.tune.options & GTUNE_LISTENER_MQ)) {
                        struct accept_queue_ring *ring;
                        unsigned int t, t0, t1, t2;