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

Kubernetes extension crashes with NPE during build #40369

Closed
adutra opened this issue Apr 30, 2024 · 6 comments · Fixed by #40596
Closed

Kubernetes extension crashes with NPE during build #40369

adutra opened this issue Apr 30, 2024 · 6 comments · Fixed by #40596
Assignees
Labels
Milestone

Comments

@adutra
Copy link
Contributor

adutra commented Apr 30, 2024

Describe the bug

Possibly caused by #38748.

When upgrading to Quarkus 3.10, the Kubernetes extension started throwing an NPE during build (see stacktrace below). The same project builds fine with Quarkus 3.9.

Workaround: adding the config option quarkus.kubernetes.vcs-uri.enabled=false makes the build pass.

Expected behavior

No build errors.

Actual behavior

> There was a failure while executing work items
   > A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
      > io.quarkus.builder.BuildException: Build failure: Build failed due to errors
                [error]: Build step io.quarkus.kubernetes.deployment.VanillaKubernetesProcessor#createDecorators threw an exception: java.lang.NullPointerException: Cannot invoke "String.indexOf(int)" because "remoteUrl" is null
                at io.dekorate.utils.Git.sanitizeRemoteUrl(Git.java:135)
                at io.quarkus.kubernetes.deployment.KubernetesCommonHelper.lambda$parseVCSUri$64(KubernetesCommonHelper.java:1198)
                at java.base/java.util.Optional.orElseGet(Optional.java:364)
                at io.quarkus.kubernetes.deployment.KubernetesCommonHelper.parseVCSUri(KubernetesCommonHelper.java:1198)
                at io.quarkus.kubernetes.deployment.KubernetesCommonHelper.lambda$createAnnotationDecorators$56(KubernetesCommonHelper.java:977)
                at java.base/java.util.Optional.ifPresent(Optional.java:178)
                at io.quarkus.kubernetes.deployment.KubernetesCommonHelper.createAnnotationDecorators(KubernetesCommonHelper.java:975)
                at io.quarkus.kubernetes.deployment.KubernetesCommonHelper.createDecorators(KubernetesCommonHelper.java:255)
                at io.quarkus.kubernetes.deployment.VanillaKubernetesProcessor.createDecorators(VanillaKubernetesProcessor.java:164)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:568)
                at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
                at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
                at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
                at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
                at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
                at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
                at java.base/java.lang.Thread.run(Thread.java:833)
                at org.jboss.threads.JBossThread.run(JBossThread.java:483)

How to Reproduce?

  1. Checkout this project and branch: Kubernetes Operator for Nessie projectnessie/nessie#7967
  2. Edit operator/src/main/resources/application.properties, remove line 16: quarkus.kubernetes.vcs-uri.enabled=false
  3. Run ./gradlew :nessie-operator:build in the repo root.

Output of uname -a or ver

Darwin MacBook-Pro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031 arm64

Output of java -version

openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode)

Quarkus version or git rev

3.10.0

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

------------------------------------------------------------ Gradle 8.7 ------------------------------------------------------------ Build time: 2024-03-22 15:52:46 UTC Revision: 650af14d7653aa949fce5e886e685efc9cf97c10 Kotlin: 1.9.22 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 17.0.6 (Eclipse Adoptium 17.0.6+10) OS: Mac OS X 14.4.1 aarch64

Additional information

No response

@adutra adutra added the kind/bug Something isn't working label Apr 30, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 30, 2024

/cc @geoand (kotlin,kubernetes), @iocanel (kubernetes)

adutra added a commit to adutra/nessie that referenced this issue Apr 30, 2024
@adutra adutra changed the title Kubernetes extension crashes when NPE during build Kubernetes extension crashes with NPE during build Apr 30, 2024
@adutra
Copy link
Contributor Author

adutra commented Apr 30, 2024

FYI I do have many remotes defined, and one of them is origin.

@geoand
Copy link
Contributor

geoand commented Apr 30, 2024

Thanks for reporting!

Sounds like an easy fix, but it would be in Dekorate, not Quarkus itself

@iocanel iocanel self-assigned this Apr 30, 2024
@adutra
Copy link
Contributor Author

adutra commented Apr 30, 2024

Yes I imagined. That said, on the Quarkus side, we might want to test if scm.getRemote().get("origin") is null... not everyone has a remote called origin ;-)

@geoand
Copy link
Contributor

geoand commented Apr 30, 2024

That sounds like a very specific workaround 😀

adutra added a commit to adutra/nessie that referenced this issue May 6, 2024
adutra added a commit to adutra/nessie that referenced this issue May 7, 2024
adutra added a commit to adutra/nessie that referenced this issue May 7, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue May 13, 2024
@gsmet
Copy link
Member

gsmet commented May 13, 2024

While I agree we need a fix in Dekorate, I also think our code in Quarkus is unnecessarily brittle.

I created #40596 to avoid pushing null to the Dekorate method.

@adutra can you check the PR?

@quarkus-bot quarkus-bot bot added this to the 3.11 - main milestone May 14, 2024
@gsmet gsmet modified the milestones: 3.11 - main, 3.10.1 May 14, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue May 14, 2024
Fixes quarkusio#40369

(cherry picked from commit a80a37e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants