dnsdist: Reset origFD asap to keep the outstanding count correct #4365

Merged
merged 1 commit into from Aug 29, 2016

Projects

None yet

1 participant

@rgacogne
Member

Previously the health check thread waited until we had finished
with the IDState to set origFD to -1, but:

  • for the UDP client thread, the only difference it makes is that
    outstanding will not be incremented if origFD is not -1,
    which is not what we want since we are going to decrement it
  • for the UDP responder thread, it actually increases the
    likelihood of decrementing outstanding twice, once in the
    responder threader and once in the health check thread.

This was especially likely to be an issue because the health check
thread used to call gettime() and to acquire a mutex before
setting origFD to -1.

This might help with #4344.

@rgacogne rgacogne dnsdist: Reset origFD asap to keep the outstanding count correct
Previously the health check thread waited until we had finished
with the IDState to set `origFD` to -1, but:
* for the UDP client thread, the only difference it makes is that
`outstanding` will not be incremented if `origFD` is not -1,
which is not what we want since we are going to decrement it
* for the UDP responder thread, it actually increases the
likelihood of decrementing `outstanding` twice, once in the
responder threader and once in the health check thread.

This was especially likely to be an issue because the health check
thread used to call `gettime()` and to acquire a mutex before
setting `origFD` to -1.
51642fe
@rgacogne rgacogne added the dnsdist label Aug 25, 2016
@rgacogne rgacogne merged commit 38f67e9 into PowerDNS:master Aug 29, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rgacogne rgacogne deleted the rgacogne:dnsdist-outstanding-race branch Aug 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment