azure-functions-java-worker icon indicating copy to clipboard operation
azure-functions-java-worker copied to clipboard

[BUG] Java class DnsContextFactory could not be found the DNS on Azure function service.

Open SangNguyenTL opened this issue 3 years ago • 2 comments

Repro steps

Provide the steps required to reproduce the problem:

  1. Call Azure key vault, Service bus, Storage APIs,... by Netty.
  2. Netty will be resolved DNS by DirContextUtils class to get host IP of the above APIs.
  3. DirContextUtils is got host name via DnsContextFactory.

Expected behavior

Provide a description of the expected behavior.

  • After DirContextUtils is performed, the DNS string is dns://xxxx dns://yyyy

Actual behavior

Provide a description of the actual behavior observed.

  • The DNS string is dns:// (empty)
  • The Netty will call a fallback function to resolve IPs. The fallback function will be used the Google DNS. I don't want use this DNS for my Azure function.

Related information

Provide any related information

  • Programming language used: Java 11
  • Links to source: DirContextUtils
  • Netty version: 4.1.68 - 4.1.70
  • Os: win

Some settings of Azure function:

  • Configuration: WEBSITE_DNS_SERVER = 168.63.129.16 WEBSITE_CONTENTOVERVNET = 1 WEBSITE_VNET_ROUTE_ALL = 1 FUNCTIONS_EXTENSION_VERSION = ~4

  • Networking: Vnet: enabled

2021-12-08T06:29:34.017 [Information] DEBUG io.netty.resolver.dns.DirContextUtils: Skipping a malformed nameserver URI: dns://
2021-12-08T06:29:34.018 [Information] java.net.URISyntaxException: Expected authority at index 6: dns://
2021-12-08T06:29:34.018 [Information] at java.base/java.net.URI$Parser.fail(URI.java:2913)
2021-12-08T06:29:34.018 [Information] at java.base/java.net.URI$Parser.failExpecting(URI.java:2919)
2021-12-08T06:29:34.018 [Information] at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3163)
2021-12-08T06:29:34.018 [Information] at java.base/java.net.URI$Parser.parse(URI.java:3114)
2021-12-08T06:29:34.019 [Information] at java.base/java.net.URI.<init>(URI.java:600)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DirContextUtils.addNameServers(DirContextUtils.java:56)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider.<clinit>(DefaultDnsServerAddressStreamProvider.java:53)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder$1.provider(DnsServerAddressStreamProviders.java:140)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder$1.<init>(DnsServerAddressStreamProviders.java:120)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder.<clinit>(DnsServerAddressStreamProviders.java:118)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DnsServerAddressStreamProviders.unixDefault(DnsServerAddressStreamProviders.java:107)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DnsServerAddressStreamProviders.platformDefault(DnsServerAddressStreamProviders.java:103)
2021-12-08T06:29:34.019 [Information] at io.netty.resolver.dns.DnsNameResolverBuilder.<init>(DnsNameResolverBuilder.java:60)
2021-12-08T06:29:34.019 [Information] at reactor.netty.transport.NameResolverProvider.newNameResolverGroup(NameResolverProvider.java:432)
2021-12-08T06:29:34.019 [Information] at reactor.netty.tcp.TcpResources.getOrCreateDefaultResolver(TcpResources.java:306)
2021-12-08T06:29:34.019 [Information] at reactor.netty.http.HttpResources.getOrCreateDefaultResolver(HttpResources.java:140)
2021-12-08T06:29:34.019 [Information] at reactor.netty.http.client.HttpClientConfig.defaultAddressResolverGroup(HttpClientConfig.java:380)
2021-12-08T06:29:34.019 [Information] at reactor.netty.transport.ClientTransportConfig.resolverInternal(ClientTransportConfig.java:219)
2021-12-08T06:29:34.019 [Information] at reactor.netty.http.client.HttpClientConfig.resolverInternal(HttpClientConfig.java:434)
2021-12-08T06:29:34.019 [Information] at reactor.netty.http.client.HttpClientConnect$MonoHttpConnect.lambda$subscribe$0(HttpClientConnect.java:265)
2021-12-08T06:29:34.019 [Information] at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:57)
2021-12-08T06:29:34.019 [Information] at reactor.core.publisher.FluxRetryWhen.subscribe(FluxRetryWhen.java:76)
2021-12-08T06:29:34.019 [Information] at reactor.core.publisher.MonoRetryWhen.subscribeOrReturn(MonoRetryWhen.java:46)
2021-12-08T06:29:34.019 [Information] at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
2021-12-08T06:29:34.019 [Information] at reactor.netty.http.client.HttpClientConnect$MonoHttpConnect.subscribe(HttpClientConnect.java:272)
2021-12-08T06:29:34.019 [Information] at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.FluxRetryWhen.subscribe(FluxRetryWhen.java:76)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.MonoRetryWhen.subscribeOrReturn(MonoRetryWhen.java:46)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.MonoDelaySubscription.accept(MonoDelaySubscription.java:52)
2021-12-08T06:29:34.020 [Information] at reactor.core.publisher.MonoDelaySubscription.accept(MonoDelaySubscription.java:33)
2021-12-08T06:29:34.021 [Information] at reactor.core.publisher.FluxDelaySubscription$DelaySubscriptionOtherSubscriber.onNext(FluxDelaySubscription.java:130)
2021-12-08T06:29:34.021 [Information] at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:119)
2021-12-08T06:29:34.021 [Information] at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
2021-12-08T06:29:34.021 [Information] at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
2021-12-08T06:29:34.021 [Information] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2021-12-08T06:29:34.021 [Information] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
2021-12-08T06:29:34.021 [Information] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2021-12-08T06:29:34.021 [Information] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2021-12-08T06:29:34.021 [Information] at java.base/java.lang.Thread.run(Thread.java:829)
2021-12-08T06:29:34.021 [Information] WARN  io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider: Default DNS servers: [/8.8.8.8:53, /8.8.4.4:53] (Google Public DNS as a fallback)

SangNguyenTL avatar Dec 08 '21 09:12 SangNguyenTL

Today I try to deploy my application to Azure Function Os Linux. Unexpectedly, the system got a normal DNS with DNS now: dns://127.0.0.11

I think the problem here is that JNDI is not getting DNS information from the Window side.

SangNguyenTL avatar Dec 09 '21 09:12 SangNguyenTL

I have a problem the same with him when I used the azure function :

  • JAVA 11
  • Spring boot 2.5.4
  • Spring keyvault secret 3.50
  • Netty version: 4.1.68 - 4.1.70
  • Os: window When my application tries to resolve the domain name of keyvault to IP. It can not get DNS address socket and then it back to queries from DNS google ( 8.8.8.8, 8.8.4.4). But on my company security doesn't accept the internal application call google DNS.

silverlightweb avatar Dec 10 '21 01:12 silverlightweb