GitHub user tisonkun created a discussion: Tips - Workaround incorrect DNS 
resolutions on MacOS

I'd like to share my experience of workaround incorrect DNS resolutions on 
MacOS for Pulsar standalone.

When you run Pulsar standalone by `bin/pulsar standalone` on MacOS, you should 
always see the following warnings:

```
2022-08-11T20:24:10,581+0800 [main] WARN  
io.netty.resolver.dns.DnsServerAddressStreamProviders - Can not find 
io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the 
classpath, fallback to system defaults. This may result in incorrect DNS 
resolutions on MacOS.
```

This is because we don't bundle the related netty resolver for DNS on MacOS. It 
may or may not cause an issue. I meet one issue today:

```
2022-08-11T14:32:22,296+0800 [main] WARN  
io.netty.resolver.dns.DnsServerAddressStreamProviders - Can not find 
io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the 
classpath, fallback to system defaults. This may result in incorrect DNS 
resolutions on MacOS.
2022-08-11T14:32:24,381+0800 [main] ERROR 
org.apache.pulsar.functions.worker.PulsarWorkerService - Error Starting up in 
worker
java.lang.ExceptionInInitializerError: null
        at 
io.netty.resolver.dns.UnixResolverDnsServerAddressStreamProvider.parseSilently(UnixResolverDnsServerAddressStreamProvider.java:80)
 ~[netty-resolver-dns-4.1.77.Final.jar:4.1.77.Final]
```

This error causes the standalone process to fail and exit.

To workaround the issue, download the necessary libs and add them to the 
classpath.

1. Download 
[netty-resolver-dns-classes-macos-4.1.77.Final.jar](https://repo1.maven.org/maven2/io/netty/netty-resolver-dns-classes-macos/4.1.77.Final)
 and 
[netty-resolver-dns-native-macos-4.1.77.Final-osx-aarch_64.jar](https://repo1.maven.org/maven2/io/netty/netty-resolver-dns-native-macos/4.1.77.Final)
 (version and arch can be varied on your env).
2. Place these two libs under a chosen folder, said `/path/to/my/libs`.
3. Run Pulsar standalone with env var `PULSAR_EXTRA_CLASSPATH` which allows 
adding extra libs:

```sh
PULSAR_EXTRA_CLASSPATH=/path/to/my/libs/* ./bin/pulsar standalone
```

The issue should be resolved atm :D

GitHub link: https://github.com/apache/pulsar/discussions/17067

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org

Reply via email to