This is an automated email from the ASF dual-hosted git repository.
junegunn pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 015f3d45a2b HBASE-30211 Exclude dnsjava InetAddressResolver SPI from
shaded jars (#8559)
015f3d45a2b is described below
commit 015f3d45a2bc887a5f07db24f8e34667079346f8
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 47bd5e02d2e..32fe1252359 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
@@ -131,6 +131,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 47bd5e02d2e..32fe1252359 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
@@ -131,6 +131,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 cd932dcccbc..05b5243fae9 100644
--- a/hbase-shaded/pom.xml
+++ b/hbase-shaded/pom.xml
@@ -467,6 +467,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>