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

Consider a trailing dot when resolve DNS with search domains #5963

Merged
merged 9 commits into from
Nov 8, 2024

Commits on Oct 30, 2024

  1. Consider a trailing dot when resolve DNS with search domains

    Motivation:
    
    There was a report from LY internally where DNS resolver warns for `NXDomain`.
    ```
    java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Empty label is not a legal name
    	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
            ...
    	at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver.resolve0(SearchDomainDnsResolver.java:99)
    	at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver.resolve(SearchDomainDnsResolver.java:88)
    	at com.linecorp.armeria.internal.client.dns.HostsFileDnsResolver.resolve(HostsFileDnsResolver.java:130)
    	at com.linecorp.armeria.internal.client.dns.DefaultDnsResolver.resolveOne(DefaultDnsResolver.java:89)
    	at com.linecorp.armeria.internal.client.dns.DefaultDnsResolver.resolve(DefaultDnsResolver.java:81)
    	at com.linecorp.armeria.client.endpoint.dns.DnsEndpointGroup.sendQueries(DnsEndpointGroup.java:155)
    	at com.linecorp.armeria.client.endpoint.dns.DnsEndpointGroup.lambda$sendQueries$3(DnsEndpointGroup.java:173)
           ...
    Caused by: java.lang.IllegalArgumentException: Empty label is not a legal name
      at java.base/java.net.IDN.toASCIIInternal(IDN.java:284)
      at java.base/java.net.IDN.toASCII(IDN.java:123)
      at java.base/java.net.IDN.toASCII(IDN.java:152)
      at com.linecorp.armeria.internal.client.dns.DnsQuestionWithoutTrailingDot.<init>(DnsQuestionWithoutTrailingDot.java:53)
      at com.linecorp.armeria.internal.client.dns.DnsQuestionWithoutTrailingDot.of(DnsQuestionWithoutTrailingDot.java:48)
      at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver$SearchDomainQuestionContext.newQuestion(SearchDomainDnsResolver.java:190)
      at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver$SearchDomainQuestionContext.nextQuestion0(SearchDomainDnsResolver.java:177)
      at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver$SearchDomainQuestionContext.nextQuestion(SearchDomainDnsResolver.java:150)
      at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver.lambda$resolve0$1(SearchDomainDnsResolver.java:103)
      ... 19 common frames omitted
    ```
    
    The NX domain has with a trailing dot and search domains starts with
    `.`. As a result, `example.com..search.domain` was made and rejected by `java.net.IDN`
    
    Modifications:
    
    - Remove a leading dot from the normalized search domains.
    - Infix a dot when a hostname does not have a trailing dot.
    
    Result:
    
    DNS resolver now correctly adds search domains for hostnames with trailing dots.
    ikhoon committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    0ef7842 View commit details
    Browse the repository at this point in the history
  2. fix broken tests

    ikhoon committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    1ff1833 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2024

  1. add ubuntu

    ikhoon committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    f6d3c22 View commit details
    Browse the repository at this point in the history

Commits on Nov 6, 2024

  1. Configuration menu
    Copy the full SHA
    d01a90e View commit details
    Browse the repository at this point in the history
  2. debug log

    ikhoon committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    331d86c View commit details
    Browse the repository at this point in the history
  3. Merge branch 'trailing-dot-searchdomain' of github.com:ikhoon/armeria…

    … into trailing-dot-searchdomain
    ikhoon committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    d300ae5 View commit details
    Browse the repository at this point in the history
  4. Fix a flaky test and minor bugs

    - Stop to send queries with search domains when it was resovled.
    - Fix a bug where the original hostname was sent as the last query
      when the number of dots in a hostname >= `ndots`.
    - Explicitly set `ResolvedAddressTypes.IPV4_ONLY` to avoid flakyness.
    ikhoon committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    a02dad0 View commit details
    Browse the repository at this point in the history
  5. lint

    ikhoon committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    ae89033 View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2024

  1. address comments by @minwoox

    ikhoon committed Nov 7, 2024
    Configuration menu
    Copy the full SHA
    90d886a View commit details
    Browse the repository at this point in the history