onobc opened a new issue, #18644:
URL: https://github.com/apache/pulsar/issues/18644

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Motivation
   
   When running on a Java client on Mac M1 we receive the annoying `WARN` log 
statement:
   
   > 22:07:00.494 [Test worker] WARN  
org.apache.pulsar.shade.io.netty.resolver.dns.DnsServerAddressStreamProviders - 
Can not find 
org.apache.pulsar.shade.io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider
 in the classpath, fallback to system defaults. This may result in incorrect 
DNS resolutions on MacOS.
   
   This can lead to actual issues - but in most cases is just an annoyance. 
   
   The suggested workaround is to add the M1-specific dependency 
[netty-resolver-dns-native-macos](
   
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-native-macos/4.1.85.Final)
 when running on M1 
([example](https://github.com/netty/netty/issues/11020#issuecomment-1193280582)).
   
   This does not work for Pulsar when using the `pulsar-client-all` shared jar 
because it attempts to load the M1 version w/ the shaded prefix 
(`org.apache.pulsar.shade.io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider`
 rather than 
`io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider`). 
   
   From `DnsServerAddressStreamProviders.java` in `pulsar-client-all:2.10.2`
   ```java
   package org.apache.pulsar.shade.io.netty.resolver.dns;
   ...
   public final class DnsServerAddressStreamProviders {
    static {
           Constructor<? extends DnsServerAddressStreamProvider> constructor = 
null;
           if (PlatformDependent.isOsx()) {
               try {
                   Object maybeProvider = AccessController.doPrivileged(new 
PrivilegedAction<Object>() {
                       public Object run() {
                           try {
                               return 
Class.forName("org.apache.pulsar.shade.io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider",
 true, DnsServerAddressStreamProviders.class.getClassLoader());
                           } catch (Throwable var2) {
                               return var2;
                           }
                       }
                   });
   ```
   
   ### Solution
   
   A couple of possible solutions: 
   
   1. Provide a pulsar artifact that comes w/ the shaded M1 lib
   
   2. Provide instructions for users to shade the lib themselves in both Gradle 
and Maven
   
   ### Alternatives
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to