Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend kafka-avro-serializer versions supported in native mode #42845

Closed
mjurc opened this issue Aug 28, 2024 · 5 comments
Closed

Extend kafka-avro-serializer versions supported in native mode #42845

mjurc opened this issue Aug 28, 2024 · 5 comments
Labels
area/kafka area/native-image kind/enhancement New feature or request triage/wontfix This will not be worked on

Comments

@mjurc
Copy link

mjurc commented Aug 28, 2024

Describe the bug

Build of native Quarkus applications with kafka-avro-serializer 7.6.* or 7.7.0 fails with the following:

Error: Unsupported features in 2 methods
Detailed message:
Error: An object of type 'org.apache.avro.reflect.ReflectData$AllowNull' was found in the image heap. This type, however, is marked for initialization at image run time for the following reason: classes are initialized at run time by default.
This is not allowed for correctness reasons: All objects that are stored in the image heap must be initialized at build time.
You now have two options to resolve this:
1) If it is intended that objects of type 'org.apache.avro.reflect.ReflectData$AllowNull' are persisted in the image heap, add
    '--initialize-at-build-time=org.apache.avro.reflect.ReflectData$AllowNull'
to the native-image arguments. Note that initializing new types can store additional objects to the heap. It is advised to check the static fields of 'org.apache.avro.reflect.ReflectData$AllowNull' to see if they are safe for build-time initialization,  and that they do not contain any sensitive data that should not become part of the image.
2) If these objects should not be stored in the image heap, you can use
    '--trace-object-instantiation=org.apache.avro.reflect.ReflectData$AllowNull'
to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with
    '--initialize-at-run-time=<culprit>'
to prevent the instantiation of the object.

We use the required dependency (jackson-dataformat-csv) to make native work with 7.5.* versions of serializer, but it seems this is not enough either.

Expected behavior

The native build passes

Actual behavior

The native build fails

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

openjdk version "21.0.2" 2024-01-16

Mandrel or GraalVM version (if different from Java)

23.1.4.0

Quarkus version or git rev

3.13, 3.14, main

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)

Additional information

No response

@mjurc mjurc added area/native-image kind/bug Something isn't working labels Aug 28, 2024
Copy link

quarkus-bot bot commented Aug 28, 2024

/cc @Karm (mandrel), @alesj (kafka), @cescoffier (kafka), @galderz (mandrel), @ozangunalp (kafka), @zakkak (mandrel,native-image)

@cescoffier
Copy link
Member

The doc says:

In native mode, Quarkus supports the following versions: `6.2.x`, `7.0.x`, `7.1.x`, `7.2.x`, `7.3.x`.

For versions `7.4.x` and `7.5.x`, due to an issue with the Confluent Schema Serializer, you need to add another dependency:

[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
.pom.xml
----
<dependency>
    <groupId>com.fasterxml.jackson.dataformat</groupId>
    <artifactId>jackson-dataformat-csv</artifactId>
</dependency>
----
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
.build.gradle
----
dependencies {
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv")
}
----

For any other versions, the native configuration may need to be adjusted.

So, without a specific native configuration, you cannot use 7.6 or 7.7. 7.6 may work by accident or chance. I'm not aware that a CVE is forcing the update.

Please report the issue in the Kafka Avro serializer repository. We cannot easily adjust the native configuration to be compatible with all new versions.

@cescoffier cescoffier added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Aug 29, 2024
@cescoffier
Copy link
Member

As explained, it's not a bug, it's an enhancement request.

@mjurc
Copy link
Author

mjurc commented Aug 31, 2024

I've opened confluentinc/schema-registry#3257 for now on serializer side.

@cescoffier
Copy link
Member

Closing—there is not much we can do (except add rules for every version, which we can't do); it's more of an upstream problem.

@cescoffier cescoffier added the triage/wontfix This will not be worked on label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kafka area/native-image kind/enhancement New feature or request triage/wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants