question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using OpenTelemetry gRPC instrumentation produces NullPointerException when running quarkusBuild

See original GitHub issue

Describe the bug

Using io.opentelemetry.instrumentation:opentelemetry-grpc-1.6:1.9.2-alpha and io.quarkus:quarkus-opentelemetry-exporter-otlp with Quarkus 2.6.2.Final produces NullPointerException when packaging image by quarkusBuild.

Expected behavior

It should produce an image without error.

Actual behavior

$ ./gradlew quarkusBuild

> Task :quarkusGenerateCode
preparing quarkus application
Base image 'foo' does not use a specific image digest - build may not be reproducible

> Task :quarkusBuild FAILED
building quarkus jar

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.container.image.jib.deployment.JibProcessor#buildFromJar threw an exception: java.lang.RuntimeException: Unable to create container image
        at io.quarkus.container.image.jib.deployment.JibProcessor.containerize(JibProcessor.java:197)
        at io.quarkus.container.image.jib.deployment.JibProcessor.buildFromJar(JibProcessor.java:136)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
  Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:547)
        at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:88)
        at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$obtainBaseImagesLayers$6(StepsRunner.java:313)
        at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
        at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
  Caused by: java.lang.NullPointerException
        at io.quarkus.opentelemetry.runtime.QuarkusContextStorage.getVertxContext(QuarkusContextStorage.java:62)
        at io.quarkus.opentelemetry.runtime.QuarkusContextStorage.current(QuarkusContextStorage.java:54)
        at io.opentelemetry.context.Context.current(Context.java:86)
        at io.opentelemetry.instrumentation.grpc.v1_6.internal.ContextStorageBridge.current(ContextStorageBridge.java:75)
        at io.grpc.override.ContextStorageOverride.current(ContextStorageOverride.java:31)
        at io.grpc.Context.current(Context.java:172)
        at io.opencensus.trace.CurrentSpanUtils.getCurrentSpan(CurrentSpanUtils.java:37)
        at io.opencensus.trace.Tracer.spanBuilder(Tracer.java:308)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:865)
        at com.google.cloud.tools.jib.http.FailoverHttpClient.call(FailoverHttpClient.java:349)
        at com.google.cloud.tools.jib.http.FailoverHttpClient.call(FailoverHttpClient.java:266)
        at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:138)
        at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:114)
        at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint(RegistryClient.java:625)
        at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest(RegistryClient.java:436)
        at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest(RegistryClient.java:441)
        at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImages(PullBaseImageStep.java:290)
        at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:157)
        at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:69)
        ... 6 more

How to Reproduce?

  1. Create a new project
mvn io.quarkus.platform:quarkus-maven-plugin:2.6.2.Final:create \
    -DprojectGroupId=my-groupId \
    -DprojectArtifactId=my-artifactId \
    -DprojectVersion=my-version \
    -DclassName="org.my.group.MyResource" \
    -Dextensions="resteasy,resteasy-jackson" \
    -DbuildTool=gradle
  1. Add dependencies
    implementation 'io.quarkus:quarkus-container-image-jib'
    implementation 'io.opentelemetry.instrumentation:opentelemetry-grpc-1.6:1.9.2-alpha'
    implementation 'io.quarkus:quarkus-opentelemetry-exporter-otlp'
  1. Add properties to gradle.properties file
quarkus.container-image.build=true
quarkus.jib.base-jvm-image=ghcr.io/foo/bar

quarkus.container-image.group=foo
quarkus.container-image.name=bar
  1. Run ./gradlew quarkusBuild

Output of uname -a or ver

21.2.0

Output of java -version

openjdk version “16.0.1” 2021-04-20 OpenJDK Runtime Environment (build 16.0.1+9-24) OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.2.Final

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

Gradle 7.3.3

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
geoandcommented, Jan 21, 2022

That sounds similar to #22866.

Yeah, but #22866 is not working for this new situation by disable otel while pulling image.

I know, I never said it would fix your latest issue. What I am saying is that the root cause is similar.

I am curious why #22865 is not the proper solution. It fixed a potential nullpointer error, and it can also fix the old issue. (Not testing the new one)

Because it’s just a bandaid. We don’t want arbitrary Vert.x contexts popping up out of nowhere.

0reactions
XSAMcommented, Jan 28, 2022

Adding @QuarkusTest annotation to the test case could fix this latest issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using OpenTelemetry - Quarkus
This command generates the Maven project and imports the quarkus-opentelemetry extension, which includes the default OpenTelemetry support, and a gRPC span ...
Read more >
Home of Quarkus Cheat-Sheet - GitHub Pages
Use Quarkus.waitForExit() from the main thread if you want to run some logic on startup, and then run like a normal application (i.e....
Read more >
chore(deps): update dependency io.quarkus:quarkus ... - GitLab
An error occurred while retrieving approval data for this merge request. chore(deps): update dependency io.quarkus:quarkus ...
Read more >
Getting Started | OpenTelemetry
You'll work with gRPC's Java Quick start example, which uses gRPC to communicate ... First, get and run the hello-world example without instrumentation:....
Read more >
quarkusio/quarkus 2.6.3.Final on GitHub - NewReleases.io
... of OpenTelemetry does not break Jib builds; #22864 - Using OpenTelemetry gRPC instrumentation produces NullPointerException when running quarkusBuild ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found