Skip to content

--initialize-at-build-time appears to be ignored | AWS XRay SDK #6785

@sherl0cks

Description

@sherl0cks

Describe the bug
I'm trying to get the AWS XRay SDK working using Manual Instrumentation from this doc. When doing so, I get an error during mvn clean install -Dnative -Dquarkus.native.container-build=true :

Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a FileDescriptor in the image heap. File descriptors opened during image generation are no longer open at image run time, and the files might not even be present anymore at image run time.  To see how this object got instantiated use -H:+TraceClassInitialization. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image run time by using the option --initialize-at-build-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace:  object java.net.PlainDatagramSocketImpl
        object java.net.DatagramSocket
        object com.amazonaws.xray.emitters.DefaultEmitter
        object com.amazonaws.xray.AWSXRayRecorder
        field com.amazonaws.xray.AWSXRay.globalRecorder

Setting --initialize-at-build-time=com.amazonaws.xray in quarkus.native.additional-build-args appears to have no effect. I notice that --initialize-at-build-time= is set twice per #5480.

Expected behavior
Setting --initialize-at-build-time=com.amazonaws.xray would lead the static field with a file handle to resolve at build time, and the stack trace to go away.

Actual behavior
It doesn't happen, even though I'm following guidance from the stacktrace.

To Reproduce
Steps to reproduce the behavior:

  1. Add to your pom.xml
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-xray-recorder-sdk-aws-sdk-v2</artifactId>
            <version>2.4.0</version>
        </dependency>
  1. Instrument the AWS SDK per Manual Instrumentation from this doc.
  2. Update application.properties with --initialize-at-build-time=com.amazonaws.xray
  3. mvn clean install -Dnative -Dquarkus.native.container-build=true

Configuration

quarkus.lambda.handler=myHandler
quarkus.ssl.native=true
quarkus.native.additional-build-args=\
  -H:ReflectionConfigurationFiles=reflection-config.json,\
  --initialize-at-build-time=com.amazonaws.xray,\
  --initialize-at-run-time=com.some.avro

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin Kernel Version 18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
  • Output of java -version: openjdk version "1.8.0_212"
    OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
    OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)
  • GraalVM version (if different from Java): 19.2.1-grl via sdkman
  • Quarkus version or git rev: 1.1.1.Final

Additional context
If you need a reproducer, let me know. I could create one on Monday.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions