fix(build): plain cli fails all queries on JDK 18+ — discard classless resolver-SPI registration (#171) - #174
Draft
fupelaqu wants to merge 1 commit into
Draft
fix(build): plain cli fails all queries on JDK 18+ — discard classless resolver-SPI registration (#171)#174fupelaqu wants to merge 1 commit into
fupelaqu wants to merge 1 commit into
Conversation
…e entry from cli assemblies (Closed Issue #171) dnsjava (transitive via hadoop-client -> hadoop-common) ships META-INF/services/java.net.spi.InetAddressResolverProvider registering org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider, but that class only exists under META-INF/versions/18/ of the multi-release jar, which the cli assembly's META-INF discard rule drops. The kept classless registration makes JDK 18+ (JEP 418) fail every name resolution — every query fails on JDK 21 with the published 0.20.1 plain cli assemblies. Discard the service entry in the shared cliProject merge strategy (covers es6/7/8/9 cli). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #171.
Root cause
dnsjava(transitive:dnsjava:dnsjava:3.6.1←org.apache.hadoop:hadoop-common:3.4.2←org.apache.hadoop:hadoop-client:3.4.2←softclient4es-core) shipsMETA-INF/services/java.net.spi.InetAddressResolverProviderregisteringorg.xbill.DNS.spi.DnsjavaInetAddressResolverProvider.dnsjava 3.6.x is a multi-release jar: that provider class exists only under
META-INF/versions/18/. The cli assembly merge strategy keeps everyMETA-INF/services/*entry (MergeStrategy.concat) but discards everything else underMETA-INF/— including the versioned class directories. The plain cli assemblies therefore ship the SPI registration without its class.On JDK 18+ (JEP 418), the
InetAddressResolverSPI is consulted on the first name resolution: the JVM tries to load the registered provider, fails withServiceConfigurationError/ClassNotFoundException, and every query fails (reproduced on JDK 21 with the published 0.20.1 assemblies, found while validating PR #170). JDK 11/17 never consult the SPI, which is why this went unnoticed.Fix
Add a more specific case before the services-concat line in the shared
cliProjectmerge strategy (covers all cli assemblies — es6/7/8/9):The class isn't shipped, so the registration must not be either — the JVM then falls back to the built-in resolver.
Evidence
Before (assembly built from
main@ 12e60dd, same 0.20.1 layout as the published jar):…while
org/xbill/DNS/spi/in the same jar contains onlyDNSJavaNameServiceandDNSJavaNameServiceDescriptor— noDnsjavaInetAddressResolverProviderclass (confirming the classless registration).After (assembly rebuilt with the fix): the
META-INF/services/java.net.spi.InetAddressResolverProviderentry is gone; all other service registrations (ExtensionSpi, ElasticClientSpi, Lucene codecs, jackson, slf4j, JLine providers, …) are intact.Smoke tests (ES 8.18.3 single-node Docker, port 9271)
java -jar softclient4es8-cli-0.20.1-assembly.jar -p 9271 -c "SHOW TABLES"→✅ No rows returned (250ms), metricsSuccess Rate: 100.0%, zeroInetAddressResolvererrors. Connecting to localhost proves the built-in resolver is used.✅ No rows returned (244ms),Success Rate: 100.0%— no regression.Versioning
No version bump — stays 0.20.1 and rides the 0.20.2 line via the epic PRs.
Refs #169 and PR #170 (where the bug was found).
🤖 Generated with Claude Code