]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Prevent race while creating new TCP worker threads
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 12 Dec 2016 15:28:17 +0000 (16:28 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 12 Dec 2016 15:28:17 +0000 (16:28 +0100)
commitded1985a766447fbb444a6db1cc1f809f8c19e21
tree4067727fd1dfff2f6015c8c752ec021b20833acb
parent2cef0511ede2968db8b14dc1eefff92b3329c264
dnsdist: Prevent race while creating new TCP worker threads

We try very hard to avoid using locks, but we need to prevent two
threads inserting into the TCP workers vector concurrently. While
this can't happen at runtime since the healthcheck thread is the
only one calling `g_tcpclientthreads->addTCPClientThread()`, this
might happen at startup time because we start the TCP acceptor
threads one after another and they all call it once.
This might result, for example, in one vector entry being overwritten
and another one remaining value-initialized to zero.
pdns/dnsdist-lua.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdist.hh