Skip to content
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

rgacogne
Copy link
Member

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)

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.
@Habbie
Copy link
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
Copy link
Member Author

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
@rgacogne rgacogne deleted the dnsdist-cleanup-tcp-downstreams branch March 21, 2017 13:15
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.

None yet

2 participants