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

JAR build doesn't work after upgrade to 3.16.4 -> 3.17.3 #44937

Open
zilinjak opened this issue Dec 5, 2024 · 5 comments
Open

JAR build doesn't work after upgrade to 3.16.4 -> 3.17.3 #44937

zilinjak opened this issue Dec 5, 2024 · 5 comments
Labels
area/container-image area/kotlin kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.

Comments

@zilinjak
Copy link

zilinjak commented Dec 5, 2024

Describe the bug

Hey, after updating to the quarkus 3.17.2 from 3.16.4 Im getting this startup error.

java -jar .\build\quarkus-app\quarkus-run.jar
The DelayedHandler was closed before any children handlers were configured. Messages will be written to stderr.
2024-12-05 12:28:31,754 DEBUG [org.jboss.logging] (main) Logging Provider: org.jboss.logging.JBossLogManagerProvider

2024-12-05 12:28:31,759 DEBUG [io.smallrye.config] (main) SRCFG01006: Loaded ConfigSource BuildTime RunTime Fixed with ordinal 2147483647

2024-12-05 12:28:31,759 DEBUG [io.smallrye.config] (main) SRCFG01006: Loaded ConfigSource SysPropConfigSource with ordinal 400

2024-12-05 12:28:31,759 DEBUG [io.smallrye.config] (main) SRCFG01006: Loaded ConfigSource EnvConfigSource with ordinal 300

2024-12-05 12:28:31,759 DEBUG [io.smallrye.config] (main) SRCFG01006: Loaded ConfigSource PropertiesConfigSource[source=jar:file:///C:/Users/zilin/Work/Kosik/pfm-gateway-ksp-auth/build/quarkus-app/app/quarkus-pfm-gateway.jar!/application.properties] with ordinal 250

2024-12-05 12:28:31,759 DEBUG [io.smallrye.config] (main) SRCFG01006: Loaded ConfigSource DefaultValuesConfigSource with ordinal -2147483648

2024-12-05 12:28:31,802 FINE  [io.grpc.NameResolverRegistry] (main) Service loader found io.grpc.internal.DnsNameResolverProvider@34e9fd99

2024-12-05 12:28:31,803 FINE  [io.grpc.NameResolverRegistry] (main) Service loader found io.grpc.netty.UdsNameResolverProvider@43bc63a3

2024-12-05 12:28:31,811 FINE  [io.grpc.LoadBalancerRegistry] (main) Service loader found Provider{policy=round_robin, priority=5, available=true}

2024-12-05 12:28:31,811 FINE  [io.grpc.LoadBalancerRegistry] (main) Service loader found OutlierDetectionLoadBalancerProvider{policy=outlier_detection_experimental, priority=5, available=true}

2024-12-05 12:28:31,811 FINE  [io.grpc.LoadBalancerRegistry] (main) Service loader found PickFirstLoadBalancerProvider{policy=pick_first, priority=5, available=true}

2024-12-05 12:28:31,899 DEBUG [io.netty.util.internal.logging.InternalLoggerFactory] (main) Using SLF4J as the default logging framework

2024-12-05 12:28:31,899 DEBUG [io.netty.util.internal.InternalThreadLocalMap] (main) -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024

2024-12-05 12:28:31,899 DEBUG [io.netty.util.internal.InternalThreadLocalMap] (main) -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096

2024-12-05 12:28:31,905 DEBUG [io.quarkus.arc.impl] (main) ArC DI container initialized [beans=167, observers=6]

2024-12-05 12:28:31,910 DEBUG [io.vertx.core.logging.LoggerFactory] (main) Using io.vertx.core.logging.SLF4JLogDelegateFactory

2024-12-05 12:28:31,911 DEBUG [io.netty.util.ResourceLeakDetector] (main) -Dio.netty.leakDetection.level: simple

2024-12-05 12:28:31,911 DEBUG [io.netty.util.ResourceLeakDetector] (main) -Dio.netty.leakDetection.targetRecords: 4

2024-12-05 12:28:31,912 TRACE [io.quarkus.arc.requestContext] (main) Destroy 
        io.quarkus.arc.impl.RequestContext.destroy(RequestContext.java:206)
        io.quarkus.arc.impl.RequestContext.destroy(RequestContext.java:200)
        io.quarkus.arc.ManagedContext.terminate(ManagedContext.java:50)
        io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:443)
        io.quarkus.arc.Arc.shutdown(Arc.java:65)
        io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:56)
        io.quarkus.runtime.StartupContext.runAllAndClear(StartupContext.java:79)
        ...

2024-12-05 12:28:31,912 TRACE [io.quarkus.arc.requestContext] (main) Deactivate
        io.quarkus.arc.impl.RequestContext.deactivate(RequestContext.java:184)
        io.quarkus.arc.ManagedContext.terminate(ManagedContext.java:51)
        io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:443)
        io.quarkus.arc.Arc.shutdown(Arc.java:65)
        io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:56)
        io.quarkus.runtime.StartupContext.runAllAndClear(StartupContext.java:79)
        io.quarkus.runtime.StartupContext.close(StartupContext.java:70)
        ...

2024-12-05 12:28:31,918 DEBUG [io.quarkus.arc.impl] (main) ArC DI container shut down

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:62)
        at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:33)
Caused by: java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
        at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160)
        at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:300)
        at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:103)
        at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:200)
        at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:549)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        ... 3 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
        ... 16 more
Caused by: java.lang.ExceptionInInitializerError
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:534)
        at java.base/java.lang.Class.forName(Class.java:513)
        at io.quarkus.arc.runtime.InterceptedStaticMethodsRecorder.callInitializer(InterceptedStaticMethodsRecorder.java:17)
        at io.quarkus.deployment.steps.InterceptedStaticMethodsProcessor$callInitializer254957675.deploy_0(Unknown Source)
        at io.quarkus.deployment.steps.InterceptedStaticMethodsProcessor$callInitializer254957675.deploy(Unknown Source)
        ... 17 more
Caused by: jakarta.enterprise.inject.CreationException: Error creating synthetic bean [Le6zQbzkojAYO_OiKIQWJf4lGa4]: jakarta.enterprise.inject.CreationException: Synthetic bean instance for io.opentelemetry.api.OpenTelemetry not initialized yet: io_opentelemetry_api_OpenTelemetry_4087e2c748253198bc7b05f31387f3f4492f0131
        - a synthetic bean initialized during RUNTIME_INIT must not be accessed during STATIC_INIT
        - RUNTIME_INIT build steps that require access to synthetic beans initialized during RUNTIME_INIT should consume the SyntheticBeansRuntimeInitBuildItem
        at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.doCreate(Unknown Source)
        at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.create(Unknown Source)
        at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.create(Unknown Source)
        at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)
        at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
        at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:32)
        at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
        at io.quarkus.arc.impl.ComputingCacheContextInstances.computeIfAbsent(ComputingCacheContextInstances.java:19)
        at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:35)
        at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.get(Unknown Source)
        at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.get(Unknown Source)
        at io.quarkus.opentelemetry.runtime.tracing.cdi.WithSpanInterceptor_Bean.doCreate(Unknown Source)
        at io.quarkus.opentelemetry.runtime.tracing.cdi.WithSpanInterceptor_Bean.create(Unknown Source)
        at io.quarkus.opentelemetry.runtime.tracing.cdi.WithSpanInterceptor_Bean.get(Unknown Source)
        at io.quarkus.opentelemetry.runtime.tracing.cdi.WithSpanInterceptor_Bean.get(Unknown Source)
        at cz.kosik.kms.gateway.service.UtilsKt_InterceptorInitializer.init_retry_9961acfe0f13cb4647f5be292c4d7ae9b94ccf78(Unknown Source)
        at cz.kosik.kms.gateway.service.UtilsKt_InterceptorInitializer.init_static_intercepted_methods(Unknown Source)
        at io.quarkus.arc.runtime.InterceptedStaticMethodsInitializer.<clinit>(Unknown Source)
        ... 23 more
Caused by: jakarta.enterprise.inject.CreationException: Synthetic bean instance for io.opentelemetry.api.OpenTelemetry not initialized yet: io_opentelemetry_api_OpenTelemetry_4087e2c748253198bc7b05f31387f3f4492f0131
        - a synthetic bean initialized during RUNTIME_INIT must not be accessed during STATIC_INIT
        - RUNTIME_INIT build steps that require access to synthetic beans initialized during RUNTIME_INIT should consume the SyntheticBeansRuntimeInitBuildItem
        at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.createSynthetic(Unknown Source)
        ... 42 more

used dependencies:

quarkusPlatformVersion = 3.17.3
...
    implementation(enforcedPlatform("$quarkusPlatformGroupId:$quarkusPlatformArtifactId:$quarkusPlatformVersion"))
    implementation("io.quarkus:quarkus-micrometer-registry-prometheus:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-smallrye-health:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-container-image-jib:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-grpc:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-smallrye-jwt:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-arc:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-opentelemetry:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-smallrye-fault-tolerance:$quarkusPlatformVersion")
    implementation("io.quarkus:quarkus-rest-kotlin:$quarkusPlatformVersion")
...

Expected behavior

Builds and runs fine

Actual behavior

Crashes on startup

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

java version "21.0.3" 2024-04-16 LTS Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152) Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)

Quarkus version or git rev

3.17.2

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

Gradle 8.11.1

Additional information

No response

@zilinjak zilinjak added the kind/bug Something isn't working label Dec 5, 2024
Copy link

quarkus-bot bot commented Dec 5, 2024

/cc @geoand (jib,kotlin)

@geoand
Copy link
Contributor

geoand commented Dec 5, 2024

Please attach a sample application that works in 3.16.3 and not 3.17.2.

Thanks!

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Dec 5, 2024
@gsmet
Copy link
Member

gsmet commented Dec 5, 2024

I think this is probably the key part to be able to create a reproducer:

        at io.quarkus.opentelemetry.runtime.tracing.cdi.WithSpanInterceptor_Bean.get(Unknown Source)
        at cz.kosik.kms.gateway.service.UtilsKt_InterceptorInitializer.init_retry_9961acfe0f13cb4647f5be292c4d7ae9b94ccf78(Unknown Source)
        at cz.kosik.kms.gateway.service.UtilsKt_InterceptorInitializer.init_static_intercepted_methods(Unknown Source)
        at io.quarkus.arc.runtime.InterceptedStaticMethodsInitializer.<clinit>(Unknown Source)

You end up initializing the interceptor that uses OpenTelemetry at static init which is not possible anymore.

So I would focus on that to create a reproducer, and ideally explain what you're trying to achieve with this so we can maybe provide other ways to achieve it.

@zilinjak
Copy link
Author

zilinjak commented Dec 5, 2024

@gsmet @geoand

I found it, I have also added @WithSpan annotation from OpenTelemetry to function inside Utils.kt file. This resulted in the build error. I guess we can close this issue :) and create new one for the @WithSpan annotation. This was causing issues on both versions.

Here is the code that broke the build

@Suppress("TooGenericExceptionCaught")
@WithSpan
suspend fun <T> retry(
    operation: suspend () -> T,
    maxRetries: Int,
    initialDelay: Long,
): T? {
    var delay = initialDelay
    var attempt = 0
    while (attempt <= maxRetries) {
        try {
            return operation()
        } catch (e: Throwable) {
            if (attempt != maxRetries) {
                delay(delay)
            }
            attempt++
            delay *= 2
        }
    }
    return null
}

after removing the @WithSpan it works fine :) sorry

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Dec 5, 2024
@geoand
Copy link
Contributor

geoand commented Dec 5, 2024

We would still very much like to see the sample application that behaves like you say.

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/container-image area/kotlin kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

No branches or pull requests

3 participants