-
Notifications
You must be signed in to change notification settings - Fork 23
Support of address reuse in server reload #6
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
Conversation
Update server reload logic to support multiple servers having the same address Signed-off-by: Gleb Kogtev <[email protected]>
|
It won’t work properly in case of multiple servers with different addresses. I’ll update this PR soon. |
Signed-off-by: Gleb Kogtev <[email protected]>
|
Fixed issue with different addresses. Start CoreDNS server: Test DNS requests: Server - Server - Server - Increse reuseport for Check using sockets: Re-run tests: Server Server |
|
Can you add tests for this? |
|
@johnbelamaric do you expect tests for this piece of code: or for this: Or for the whole restart process? It would be a bit difficult, as we're working with the real connections and file descriptors and caddy server doesn't have tests for this right now. |
|
Yeah, I saw no existing tests. Just worries me to change the logic and expect it to just work. What about at least a CI test that does what you did manually? ie, restarts with a couple different servers/configs and makes sure the resulting sockets are correct? |
|
Hello! What do we need to do to make this CI test? We need to fix caddy in this repository, update version of caddy in the coredns repository with numsockets fix, and then make reload tests in https://github.com/coredns/ci. Also I have an idea how to test everything. We doesn't have tests in caddy for Restart, but we have them in CoreDNS - https://github.com/coredns/coredns/blob/master/test/reload_test.go |
Hello. I wrote a draft of the unit test to make sure of this - reload_test.patch And I will say that it is impossible to test it at all.
However, I added a reload test for |
We're preparing changes to CoreDNS to support SO_REUSEPORT option, which allowes user to create multiple listening sockets to the same port - coredns/coredns#6882.
Currently we may receive unexpected behaviour during server reload because caddy handles file descriptors as one fd per address.
Before reload:
After reload:
So this change in caddy assumes that we may get multiple servers listening the same address.