Skip to content

Conversation

@rgacogne
Copy link
Member

Short description

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.

Reported and very kindly investigated by @paddg (thanks!).

Checklist

I have:

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.
@rgacogne rgacogne merged commit 3a9f699 into PowerDNS:master Dec 14, 2016
@rgacogne rgacogne deleted the dnsdist-tcp-workers-vect-race branch December 14, 2016 09:53
rgacogne added a commit to rgacogne/pdns that referenced this pull request Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant