Skip to content

DD 1.38.1 doesn't work on native #7479

@luneo7

Description

@luneo7

When trying to build natively with DD 1.38.1 we've got the following error:

Error: An object of type 'datadog.trace.api.Config' 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 'datadog.trace.api.Config' are persisted in the image heap, add 

    '--initialize-at-build-time=datadog.trace.api.Config'

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 'datadog.trace.api.Config' 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=datadog.trace.api.Config'

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=datadog.trace.api.Config' 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.
Detailed message:
Trace: Object was reached by
  reading field datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder.config of constant 
    datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder@c0e575: datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder@c0e575
  indexing into array datadog.trace.agent.core.tagprocessor.TagsPostProcessor[]@454656a1: [Ldatadog.trace.agent.core.tagprocessor.TagsPostProcessor;@454656a1
  reading field datadog.trace.agent.core.tagprocessor.PostProcessorChain.chain of constant 
    datadog.trace.agent.core.tagprocessor.PostProcessorChain@33682bfa: datadog.trace.agent.core.tagprocessor.PostProcessorChain@33682bfa
  reading static field datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.instance
    at datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.access$200(TagsPostProcessorFactory.java:11)
  parsing method datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.access$200(TagsPostProcessorFactory.java:11) reachable via the parsing context
    at static root method.(Unknown Source)


com.oracle.svm.core.util.UserError$UserException: An object of type 'datadog.trace.api.Config' 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 'datadog.trace.api.Config' are persisted in the image heap, add 

    '--initialize-at-build-time=datadog.trace.api.Config'

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 'datadog.trace.api.Config' 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=datadog.trace.api.Config'

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=datadog.trace.api.Config' 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.
Detailed message:
Trace: Object was reached by
  reading field datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder.config of constant 
    datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder@c0e575: datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder@c0e575
  indexing into array datadog.trace.agent.core.tagprocessor.TagsPostProcessor[]@454656a1: [Ldatadog.trace.agent.core.tagprocessor.TagsPostProcessor;@454656a1
  reading field datadog.trace.agent.core.tagprocessor.PostProcessorChain.chain of constant 
    datadog.trace.agent.core.tagprocessor.PostProcessorChain@33682bfa: datadog.trace.agent.core.tagprocessor.PostProcessorChain@33682bfa
  reading static field datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.instance
    at datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.access$200(TagsPostProcessorFactory.java:11)
  parsing method datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.access$200(TagsPostProcessorFactory.java:11) 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: An object of type 'datadog.trace.api.Config' 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 'datadog.trace.api.Config' are persisted in the image heap, add 

    '--initialize-at-build-time=datadog.trace.api.Config'

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 'datadog.trace.api.Config' 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=datadog.trace.api.Config'

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=datadog.trace.api.Config' 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.
Detailed message:
Trace: Object was reached by
  reading field datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder.config of constant 
    datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder@c0e575: datadog.trace.agent.core.tagprocessor.RemoteHostnameAdder@c0e575
  indexing into array datadog.trace.agent.core.tagprocessor.TagsPostProcessor[]@454656a1: [Ldatadog.trace.agent.core.tagprocessor.TagsPostProcessor;@454656a1
  reading field datadog.trace.agent.core.tagprocessor.PostProcessorChain.chain of constant 
    datadog.trace.agent.core.tagprocessor.PostProcessorChain@33682bfa: datadog.trace.agent.core.tagprocessor.PostProcessorChain@33682bfa
  reading static field datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.instance
    at datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.access$200(TagsPostProcessorFactory.java:11)
  parsing method datadog.trace.agent.core.tagprocessor.TagsPostProcessorFactory$Lazy.access$200(TagsPostProcessorFactory.java:11) 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:126)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:809)
        ... 6 more

Seems related to https://github.com/DataDog/dd-trace-java/pull/7426/files and the setting datadog.trace.api.Config:rerun

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions