confluentinc/schema-registry

Native build of io.confluent:kafka-avro-serializer 7.6.z,7.7.0 fails with Mandrel 23.1

mjurc opened this issue · 0 comments

Attempting to build application using io.confluent:kafka-avro-serializer 7.6 or 7.7 with Mandrel 23.1 native image produces the following exceptions:

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.
                       8.4s (10.9% of total time) in 563 GCs | Peak RSS: 2.50GB | CPU load: 3.66
========================================================================================================================
Finished generating 'examples-kafka-registry-1.6.0.Beta2-SNAPSHOT-runner' in 1m 16s.

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.

If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=org.apache.avro.reflect.ReflectData$AllowNull' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.

The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.REFLECT_DATA_ALLOW_NULL_INSTANCE
    at io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectDataAllowNull(AvroSchemaUtils.java:103)
  parsing method io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectDataAllowNull(AvroSchemaUtils.java:103) reachable via the parsing context
    at static root method.(Unknown Source)

Error: An object of type 'org.apache.avro.reflect.ReflectData' 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' are persisted in the image heap, add 

    '--initialize-at-build-time=org.apache.avro.reflect.ReflectData'

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' 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'

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.

If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=org.apache.avro.reflect.ReflectData' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.

The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.REFLECT_DATA_INSTANCE
    at io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectData(AvroSchemaUtils.java:99)
  parsing method io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectData(AvroSchemaUtils.java:99) reachable via the parsing context
    at static root method.(Unknown Source)


com.oracle.svm.core.util.UserError$UserException: 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.

If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=org.apache.avro.reflect.ReflectData$AllowNull' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.

The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.REFLECT_DATA_ALLOW_NULL_INSTANCE
    at io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectDataAllowNull(AvroSchemaUtils.java:103)
  parsing method io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectDataAllowNull(AvroSchemaUtils.java:103) reachable via the parsing context
    at static root method.(Unknown Source)

Error: An object of type 'org.apache.avro.reflect.ReflectData' 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' are persisted in the image heap, add 

    '--initialize-at-build-time=org.apache.avro.reflect.ReflectData'

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' 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'

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.

If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=org.apache.avro.reflect.ReflectData' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.

The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.REFLECT_DATA_INSTANCE
    at io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectData(AvroSchemaUtils.java:99)
  parsing method io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectData(AvroSchemaUtils.java:99) reachable via the parsing context
    at static root method.(Unknown Source)


	at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:814)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: 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.

If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=org.apache.avro.reflect.ReflectData$AllowNull' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.

The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.REFLECT_DATA_ALLOW_NULL_INSTANCE
    at io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectDataAllowNull(AvroSchemaUtils.java:103)
  parsing method io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectDataAllowNull(AvroSchemaUtils.java:103) reachable via the parsing context
    at static root method.(Unknown Source)

Error: An object of type 'org.apache.avro.reflect.ReflectData' 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' are persisted in the image heap, add 

    '--initialize-at-build-time=org.apache.avro.reflect.ReflectData'

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' 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'

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.

If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=org.apache.avro.reflect.ReflectData' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.

The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.REFLECT_DATA_INSTANCE
    at io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectData(AvroSchemaUtils.java:99)
  parsing method io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils.getReflectData(AvroSchemaUtils.java:99) reachable via the parsing context
    at static root method.(Unknown Source)


	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:809)
	... 6 more

Native build works properly with version 7.5.