GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — Do not set SO_REUSEADDR on the UDP socket of TestDnsServer by normanmaurer · Pull Request #18270 · netty/netty Conversation
Member
Motivation: DnsNameResolverTest.testNameServerCache occasionally fails on CI with The test starts a second TestDnsServer (dnsServer2) that answers every A TestDnsServer enables SO_REUSEADDR on its UDP acceptor before binding to UDP has no TIME_WAIT state, so nothing in the tests needs the option. Modification: Remove the setReuseAddress(true) call from TestDnsServer.start(...). The Result: A TestDnsServer can no longer silently share its port with another one. A
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation:
DnsNameResolverTest.testNameServerCache occasionally fails on CI with
failed to resolve coccoc.com ==> expected: not equal but was: <12.34.12.34>
The test starts a second TestDnsServer (dnsServer2) that answers every A
query with 12.34.12.34 next to the shared static dnsServer, and routes only
a random subset of the hostnames to it. coccoc.com was not routed to
dnsServer2, and DnsQueryContext only accepts a response whose question
matches the query, so the query itself must have reached dnsServer2.
TestDnsServer enables SO_REUSEADDR on its UDP acceptor before binding to
127.0.0.1:0. On Linux, UDP sockets that both have SO_REUSEADDR set are not
considered to conflict, so the ephemeral port selection can hand out a port
that is already used by another such socket. When dnsServer2 gets the same
port as dnsServer, the kernel delivers all datagrams for that port to the
newest socket, which then answers queries that were meant for dnsServer
using dnsServer's address as the source. The resolver rightfully accepts
that response.
UDP has no TIME_WAIT state, so nothing in the tests needs the option.
Modification:
Remove the setReuseAddress(true) call from TestDnsServer.start(...). The
only start with a fixed port takes the port from a TCP ServerSocket, so it
does not depend on the option either.
Result:
A TestDnsServer can no longer silently share its port with another one. A
port clash now fails the bind instead of routing queries to the wrong
server, which removes the flakiness of testNameServerCache (and any other
test that starts more than one TestDnsServer).
|
There was an error while loading. Please reload this page.
✅ All tests passed ✅🏷️ Commit: d067dad Learn more about TestLens at testlens.app/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Auto-port PR for 4.1: #18275 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 5.0: #18276 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…rver (#18275) Auto-port of #18270 to 4.1 Cherry-picked commit: d6c25f4 --- Motivation: DnsNameResolverTest.testNameServerCache occasionally fails on CI with failed to resolve coccoc.com ==> expected: not equal but was: <12.34.12.34> The test starts a second TestDnsServer (dnsServer2) that answers every A query with 12.34.12.34 next to the shared static dnsServer, and routes only a random subset of the hostnames to it. coccoc.com was not routed to dnsServer2, and DnsQueryContext only accepts a response whose question matches the query, so the query itself must have reached dnsServer2. TestDnsServer enables SO_REUSEADDR on its UDP acceptor before binding to 127.0.0.1:0. On Linux, UDP sockets that both have SO_REUSEADDR set are not considered to conflict, so the ephemeral port selection can hand out a port that is already used by another such socket. When dnsServer2 gets the same port as dnsServer, the kernel delivers all datagrams for that port to the newest socket, which then answers queries that were meant for dnsServer using dnsServer's address as the source. The resolver rightfully accepts that response. UDP has no TIME_WAIT state, so nothing in the tests needs the option. Modification: Remove the setReuseAddress(true) call from TestDnsServer.start(...). The only start with a fixed port takes the port from a TCP ServerSocket, so it does not depend on the option either. Result: A TestDnsServer can no longer silently share its port with another one. A port clash now fails the bind instead of routing queries to the wrong server, which removes the flakiness of testNameServerCache (and any other test that starts more than one TestDnsServer). Co-authored-by: Norman Maurer <[email protected]>
…rver (#18276) Auto-port of #18270 to 5.0 Cherry-picked commit: d6c25f4 --- Motivation: DnsNameResolverTest.testNameServerCache occasionally fails on CI with failed to resolve coccoc.com ==> expected: not equal but was: <12.34.12.34> The test starts a second TestDnsServer (dnsServer2) that answers every A query with 12.34.12.34 next to the shared static dnsServer, and routes only a random subset of the hostnames to it. coccoc.com was not routed to dnsServer2, and DnsQueryContext only accepts a response whose question matches the query, so the query itself must have reached dnsServer2. TestDnsServer enables SO_REUSEADDR on its UDP acceptor before binding to 127.0.0.1:0. On Linux, UDP sockets that both have SO_REUSEADDR set are not considered to conflict, so the ephemeral port selection can hand out a port that is already used by another such socket. When dnsServer2 gets the same port as dnsServer, the kernel delivers all datagrams for that port to the newest socket, which then answers queries that were meant for dnsServer using dnsServer's address as the source. The resolver rightfully accepts that response. UDP has no TIME_WAIT state, so nothing in the tests needs the option. Modification: Remove the setReuseAddress(true) call from TestDnsServer.start(...). The only start with a fixed port takes the port from a TCP ServerSocket, so it does not depend on the option either. Result: A TestDnsServer can no longer silently share its port with another one. A port clash now fails the bind instead of routing queries to the wrong server, which removes the flakiness of testNameServerCache (and any other test that starts more than one TestDnsServer). Co-authored-by: Norman Maurer <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.