This is an automated email from the ASF dual-hosted git repository.

junegunn pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new 7b82e070c45 HBASE-30211 Exclude dnsjava InetAddressResolver SPI from 
shaded jars (#8559)
7b82e070c45 is described below

commit 7b82e070c451729820a6b240a784fe2207d629a7
Author: Junegunn Choi <[email protected]>
AuthorDate: Wed Aug 26 10:07:08 2026 +0900

    HBASE-30211 Exclude dnsjava InetAddressResolver SPI from shaded jars (#8559)
    
    dnsjava is a multi-release jar: its InetAddressResolverProvider service 
file sits
    at the root, but the provider class ships only under META-INF/versions/18. 
Shade
    rewrites that class's bytecode to the relocated name and leaves its jar 
entry
    path alone, and the shaded jar is not multi-release, so the merged service 
file
    names a class no classloader can load. Since JEP 418 made this a JVM level 
SPI
    in Java 18, the first name lookup fails and takes down all DNS resolution 
in the
    process, not just HBase calls.
    
    Drop the service file in the existing dnsjava filter. The provider is opt-in
    behind org.dnsjava.spi.enable, so nothing depends on it, and all relocated
    dnsjava classes stay.
    
    Guard it in ensure-jars-have-correct-contents.sh. Static rather than 
runtime,
    since precommit and nightly build on JDK 8, 11 and 17 where the SPI is never
    consulted.
    
    Signed-off-by: Xiao Liu <[email protected]>
---
 .../src/test/resources/ensure-jars-have-correct-contents.sh         | 6 ++++++
 .../src/test/resources/ensure-jars-have-correct-contents.sh         | 6 ++++++
 hbase-shaded/pom.xml                                                | 3 +++
 3 files changed, 15 insertions(+)

diff --git 
a/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
 
b/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
index 1d1350712b1..29288ca693c 100644
--- 
a/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
+++ 
b/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
@@ -129,6 +129,12 @@ for artifact in "${artifact_list[@]}"; do
   if [ ${#bad_contents[@]} -eq 0 ] && [ "${class_count}" -lt 1 ]; then
     bad_contents=("The artifact contains no java class files.")
   fi
+  # dnsjava ships its provider class only under META-INF/versions/, which 
relocation leaves at an
+  # unrelocated path in a jar that is not multi-release, so the declaration 
names a class the JVM
+  # cannot load and every DNS lookup in the process fails. See HBASE-30211.
+  if "${JAR}" tf "${artifact}" | grep -q 
'^META-INF/services/java\.net\.spi\.InetAddressResolverProvider$'; then
+    bad_contents+=("Declares java.net.spi.InetAddressResolverProvider, which 
breaks all DNS resolution on JDK18+")
+  fi
   if [ ${#bad_contents[@]} -gt 0 ]; then
     echo "[ERROR] Found artifact with unexpected contents: '${artifact}'"
     echo "    Please check the following and either correct the build or 
update"
diff --git 
a/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
 
b/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
index 1d1350712b1..29288ca693c 100644
--- 
a/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
+++ 
b/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh
@@ -129,6 +129,12 @@ for artifact in "${artifact_list[@]}"; do
   if [ ${#bad_contents[@]} -eq 0 ] && [ "${class_count}" -lt 1 ]; then
     bad_contents=("The artifact contains no java class files.")
   fi
+  # dnsjava ships its provider class only under META-INF/versions/, which 
relocation leaves at an
+  # unrelocated path in a jar that is not multi-release, so the declaration 
names a class the JVM
+  # cannot load and every DNS lookup in the process fails. See HBASE-30211.
+  if "${JAR}" tf "${artifact}" | grep -q 
'^META-INF/services/java\.net\.spi\.InetAddressResolverProvider$'; then
+    bad_contents+=("Declares java.net.spi.InetAddressResolverProvider, which 
breaks all DNS resolution on JDK18+")
+  fi
   if [ ${#bad_contents[@]} -gt 0 ]; then
     echo "[ERROR] Found artifact with unexpected contents: '${artifact}'"
     echo "    Please check the following and either correct the build or 
update"
diff --git a/hbase-shaded/pom.xml b/hbase-shaded/pom.xml
index 7654a188610..9eed800eb93 100644
--- a/hbase-shaded/pom.xml
+++ b/hbase-shaded/pom.xml
@@ -470,6 +470,9 @@
                       <exclude>jnamed*</exclude>
                       <exclude>lookup*</exclude>
                       <exclude>update*</exclude>
+                      <!-- SPI provider ships only under META-INF/versions/18; 
this jar is not
+                           multi-release, so keeping the service file breaks 
DNS on JDK18+ -->
+                      
<exclude>META-INF/services/java.net.spi.InetAddressResolverProvider</exclude>
                     </excludes>
                   </filter>
                   <filter>

Reply via email to