nparfait opened a new issue, #9010:
URL: https://github.com/apache/camel-quarkus/issues/9010
### Bug description
`camel-quarkus-support-aws2` and
`io.quarkiverse.amazonservices:quarkus-amazon-common` both register GraalVM
substitutions for `software.amazon.awssdk.checksums.internal.ChecksumProvider`.
When both are on the classpath and `aws-crt` is not, both substitutions
activate and the native image build fails hard:
```
Error: Substition:
software.amazon.awssdk.checksums.internal.ChecksumProvider.crc64NvmeCrtImplementation()
conflicts with previously registered:
software.amazon.awssdk.checksums.internal.ChecksumProvider.crc64NvmeCrtImplementation()
Internal exception: com.oracle.svm.core.util.UserError$UserException
```
(The method named in the error varies between `crc64NvmeCrtImplementation`
and `crtXxHash(ChecksumAlgorithm)` depending on processing order — both are
duplicated.)
### The two conflicting substitutions
**camel-quarkus** —
`org.apache.camel.quarkus.component.aws.commons.ChecksumProviderSubstitutions`
(`extensions-support/aws2/runtime`):
```java
@TargetClass(value = ChecksumProvider.class, onlyWith =
ChecksumProviderSubstitutions.AwsCrtIsAbsent.class)
final class ChecksumProviderSubstitutions {
@Substitute static SdkChecksum crc64NvmeCrtImplementation() { ... }
@Substitute static SdkChecksum createCrtCrc32C() { ... }
@Substitute static SdkChecksum crtXxHash(ChecksumAlgorithm algorithm) {
... }
}
```
**quarkus-amazon-services** —
`io.quarkiverse.amazon.common.runtime.CrtSubstitutions$Target_CrcChecksumProvider`:
```java
@TargetClass(value =
software.amazon.awssdk.checksums.internal.ChecksumProvider.class)
static final class Target_CrcChecksumProvider {
@Substitute @TargetElement(name = "crc64NvmeCrtImplementation", onlyWith
= IsCrtAbsent.class)
static SdkChecksum crc64NvmeCrtImplementationCrtAbsent() { ... }
@Substitute @TargetElement(name = "crtXxHash", onlyWith =
IsCrtAbsent.class)
static SdkChecksum crtXxHashCrtAbsent(ChecksumAlgorithm algorithm) { ...
}
@Delete static SdkChecksum createCrtCrc32C() { ... }
...
}
```
The quarkiverse version is a strict superset — it covers the same three
methods plus `crc32cImplementation`/`createJavaCrc32C`, and additionally
handles the CRT-present case.
### When it was introduced
`ChecksumProviderSubstitutions` was added in camel-quarkus **3.33.0** by
#8395 ("Upgrade Quarkus Amazon Services to 3.15.0"), to fix
`ClassNotFoundException: software.amazon.awssdk.crt.checksums.CRC64NVME`. It
does not exist at tag 3.32.0. The `quarkus-amazon-common` substitution predates
it (present at least as far back as 3.3.3).
The class is byte-identical in 3.33.0, 3.33.1, 3.33.2, 3.35.0, 3.36.0 and
3.38.0, so the conflict affects every release since 3.33.0.
### How to reproduce
A project depending on both:
- `org.apache.camel.quarkus:camel-quarkus-aws2-ses` (or any camel-quarkus
aws2 extension pulling `camel-quarkus-support-aws2`)
- `io.quarkiverse.amazonservices:quarkus-amazon-sns` / `quarkus-amazon-ses`
with all three platform BOMs (`quarkus-bom`, `quarkus-camel-bom`,
`quarkus-amazon-services-bom`) at the same Quarkus Platform version, and no
`software.amazon.awssdk.crt:aws-crt` on the classpath. `mvn package -Pnative`
then fails as above.
Reproduced on Quarkus Platform 3.33.3.1 (camel-quarkus 3.33.2,
quarkus-amazon-common 3.17.0, AWS SDK 2.42.7) with GraalVM 21.0.11+9.1.
The same project built fine on Quarkus Platform 3.20.x (camel-quarkus
3.20.4), where `ChecksumProviderSubstitutions` did not yet exist.
### Suggested fix
Since `quarkus-amazon-common` already provides an equivalent and broader
substitution, `camel-quarkus-support-aws2`'s `ChecksumProviderSubstitutions`
could either be removed, or guarded with an additional `onlyWith` predicate
that checks for the absence of
`io.quarkiverse.amazon.common.runtime.CrtSubstitutions` on the classpath.
### Workarounds
Only two exist, neither great:
1. Add `software.amazon.awssdk.crt:aws-crt`, which deactivates both
`onlyWith` guards — but pulls in a JNI native library and changes runtime
checksum behaviour.
2. Shadow
`org.apache.camel.quarkus.component.aws.commons.ChecksumProviderSubstitutions`
with an empty class of the same FQCN in the application's own sources, so
camel-quarkus's annotated version is never loaded.
There is no native-image option to disable an individual substitution —
`-H:DisableSubstitution` exists only on GraalVM master, not in any released
GraalVM or Mandrel.
### Environment
- camel-quarkus 3.33.2 (Quarkus Platform 3.33.3.1)
- quarkus-amazon-services 3.17.0
- AWS SDK for Java v2 2.42.7
- GraalVM CE 21.0.11+9.1 (JVMCI 23.1-b92), macOS aarch64
--
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]