New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Cleanup closed TCP downstream connections #5163

Merged
merged 1 commit into from Mar 21, 2017

Conversation

Projects
None yet
2 participants
@rgacogne
Member

rgacogne commented Mar 16, 2017

Short description

Regularly walk the TCP downstream connections to properly close whose that have been shutdown by the other end. It occurs only after a TCP client connection has been closed and at most every setTCPDownstreamCleanupInterval() seconds, defaulting to 60s.
Until now we only detected that the other end closed the connection when we tried to reuse it. While this is not an issue with a small number of backends because the connection are reused pretty quickly,
with a large number of backends dnsdist might end up with thousands of idle TCP connections to downstream servers in CLOSE_WAIT state, wasting open file descriptors.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled and tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
dnsdist: Cleanup closed TCP downstream connections
Regularly walk the TCP downstream connections to properly close
whose that have been shutdown by the other end. It occurs only
after a TCP client connection has been closed and at most every
`setTCPDownstreamCleanupInterval()` seconds, defaulting to 60s.
Until now we only detected that the other end closed the connection
when we tried to reuse it. While this is not an issue with a small
number of backends because the connection are reused pretty quickly,
with a large number of backends dnsdist might end up with thousands
of idle TCP connections to downstream servers in `CLOSE_WAIT` state,
wasting open file descriptors.

@rgacogne rgacogne added this to the dnsdist-1.2.0 milestone Mar 16, 2017

@Habbie

This comment has been minimized.

Member

Habbie commented Mar 16, 2017

Silly question: can't we put all these FDs in an (e)poll set we keep up to date, so the check does not involve iterating over all the sockets?

@rgacogne

This comment has been minimized.

Member

rgacogne commented Mar 16, 2017

Sure, the only downside is that managing an up-to-date set is going to be a pain. I'm not sure it's worth it, but I haven't looked at our existing FD multiplexer implementations so maybe we already have the code to manage that easily.

@Habbie Habbie merged commit a77e6c0 into PowerDNS:master Mar 21, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rgacogne rgacogne deleted the rgacogne:dnsdist-cleanup-tcp-downstreams branch Mar 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment