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

Random javax.enterprise.inject.IllegalProductException: Normal scoped producer method may not return null #27423

Closed
kimdv opened this issue Aug 22, 2022 · 8 comments
Labels
area/graphql area/kotlin kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@kimdv
Copy link

kimdv commented Aug 22, 2022

Describe the bug

We randomly get 2022-08-22 16:04:20,174 ERROR [io.sma.graphql] (vert.x-eventloop-thread-0) SRGQL012000: Data Fetching Error: javax.enterprise.inject.IllegalProductException: Normal scoped producer method may not return null: io.quarkus.vertx.http.runtime.CurrentVertxRequest.getCurrent() in our service.

We cannot see a pattern. We just retry the request and it then succeeds. 🤷‍♂️
We run it in docker images on a kubernetes cluster if that helps.

We also use GraphQL

Expected behavior

Not getting exception

Actual behavior

Random crashes when accessing RouteContext

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.11.1.Final

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

No response

Additional information

Stacktrace

2022-08-22 16:04:20,174 ERROR [io.sma.graphql] (vert.x-eventloop-thread-0) SRGQL012000: Data Fetching Error: javax.enterprise.inject.IllegalProductException: Normal scoped producer method may not return null: io.quarkus.vertx.http.runtime.CurrentVertxRequest.getCurrent()
	at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.create(Unknown Source)
	at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.create(Unknown Source)
	at io.quarkus.arc.impl.RequestContext.getIfActive(RequestContext.java:73)
	at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:28)
	at io.vertx.ext.web.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.arc$delegate(Unknown Source)
	at io.vertx.ext.web.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.parsedHeaders(Unknown Source)
	at com.trifork.falcon.bff.util.TranslationUtility.getLanguage(TranslationUtility.kt:36)
	at com.trifork.falcon.bff.util.TranslationUtility.getTranslation(TranslationUtility.kt:52)
	at com.trifork.falcon.bff.util.TranslationUtility$Translate$Appointments$Booking$No_times_available.title(TranslationUtility.kt:245)
	at com.trifork.falcon.bff.resource.AppointmentsResource.appointmentDates(AppointmentsResource.kt:147)
	at jdk.internal.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.smallrye.graphql.execution.datafetcher.helper.ReflectionInvoker.invoke(ReflectionInvoker.java:92)
	at io.quarkus.smallrye.graphql.runtime.spi.datafetcher.QuarkusDefaultDataFetcher.lambda$invokeAndTransformBlocking$0(QuarkusDefaultDataFetcher.java:62)
	at io.smallrye.context.impl.wrappers.SlowContextualCallable.call(SlowContextualCallable.java:21)
	at io.quarkus.smallrye.graphql.runtime.spi.datafetcher.BlockingHelper.lambda$runBlocking$0(BlockingHelper.java:27)
	at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
	at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
	at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:555)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
@ApplicationScoped
class TranslationUtility {
    @Inject
    lateinit var request: RoutingContext

    val translate: Translate
        get() = Translate(this)

    fun getLocale(): Locale {
        try {
            return LocaleUtils.toLocale(getLanguage().toLocale().replace("-", "_"))
        } catch (e: IllegalArgumentException) {
            throw BffException(
                message = "Invalid locale ${getLanguage().toLocale()}",
                title = "Locale error"
            )
        }
    }
}
@kimdv kimdv added the kind/bug Something isn't working label Aug 22, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 22, 2022

/cc @evanchooly, @geoand

@geoand
Copy link
Contributor

geoand commented Aug 22, 2022

cc @jmartisk @phillip-kruger

@phillip-kruger
Copy link
Member

phillip-kruger commented Aug 22, 2022

@kimdv : Can you please try with the latest https://github.com/quarkusio/quarkus/releases/tag/2.12.0.CR1 ? We fixed related bugs that should already solve this case.

@kimdv
Copy link
Author

kimdv commented Aug 26, 2022

It looks like it have been fixed!

Thanks 🚀

@kimdv kimdv closed this as completed Aug 26, 2022
@geoand geoand added the triage/out-of-date This issue/PR is no longer valid or relevant label Aug 26, 2022
@pipinet
Copy link

pipinet commented Nov 3, 2022

@phillip-kruger
is looks like not fixed.
same error in 2.13.3.Final, some times, when concurrency.

2022-11-03 23:15:08,317 ERROR [io.sma.graphql] (vert.x-eventloop-thread-1) SRGQL012000: Data Fetching Error: javax.enterprise.inject.IllegalProductException: Normal scoped producer method may not return null: io.quarkus.vertx.http.runtime.CurrentVertxRequest.getCurrent()
        at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.create(Unknown Source)
        at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_Bean.create(Unknown Source)
        at io.quarkus.arc.impl.RequestContext.getIfActive(RequestContext.java:76)
        at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:30)
        at io.vertx.ext.web.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.arc$delegate(Unknown Source)
        at io.vertx.ext.web.CurrentVertxRequest_ProducerMethod_getCurrent_6dc23d16d53ba5c34e1e7b6f54290fd7b9aebd76_ClientProxy.request(Unknown Source)
        at java.base/java.util.Optional.map(Optional.java:260)
        at hd.pie.core.security.domain.services.caller.CallerIdentityAugmentor.getOrgId(CallerIdentityAugmentor.java:116)
        at hd.pie.core.security.domain.services.caller.CallerIdentityAugmentor.buildCurrentCaller(CallerIdentityAugmentor.java:90)
        at hd.pie.core.security.domain.services.caller.CallerIdentityAugmentor.doAugment(CallerIdentityAugmentor.java:123)
        at hd.pie.core.security.domain.services.caller.CallerIdentityAugmentor.lambda$augment$0(CallerIdentityAugmentor.java:53)
        at io.quarkus.security.runtime.QuarkusIdentityProviderManagerImpl$1$1.get(QuarkusIdentityProviderManagerImpl.java:45)
        at io.quarkus.security.runtime.QuarkusIdentityProviderManagerImpl$1$1.get(QuarkusIdentityProviderManagerImpl.java:40)
        at io.smallrye.context.impl.wrappers.SlowContextualSupplier.get(SlowContextualSupplier.java:21)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromDeferredSupplier.subscribe(UniCreateFromDeferredSupplier.java:25)
        at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25)
        at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23)
        at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23)
        at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25)
        at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25)
        at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
        at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:60)
        at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)
        at io.smallrye.mutiny.groups.UniAwait.indefinitely(UniAwait.java:46)
        at io.quarkus.security.runtime.QuarkusIdentityProviderManagerImpl.authenticateBlocking(QuarkusIdentityProviderManagerImpl.java:132)
        at io.quarkus.security.identity.IdentityProviderManagerCreator_ProducerMethod_ipm_91f102be1b2a781216db8a81e6ab4b9b1a84f03c_ClientProxy.authenticateBlocking(Unknown Source)
        at hd.pie.core.security.domain.services.user.UserBasicAuthenticator.authenticate(UserBasicAuthenticator.java:34)
        at hd.pie.core.security.domain.services.user.UserBasicAuthenticator_Subclass.authenticate$$superforward1(Unknown Source)
        at hd.pie.core.security.domain.services.user.UserBasicAuthenticator_Subclass$$function$$1.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
        at hd.pie.core.security.domain.services.user.UserBasicAuthenticator_Subclass.authenticate(Unknown Source)
        at hd.pie.core.security.domain.services.user.UserBasicAuthenticator_ClientProxy.authenticate(Unknown Source)
        at hd.pie.graphql.IdentityGraphQLApi.basicLogin(IdentityGraphQLApi.java:35)
        at hd.pie.graphql.IdentityGraphQLApi_Subclass.basicLogin$$superforward1(Unknown Source)
        at hd.pie.graphql.IdentityGraphQLApi_Subclass$$function$$1.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
        at io.quarkus.hibernate.validator.runtime.interceptor.AbstractMethodValidationInterceptor.validateMethodInvocation(AbstractMethodValidationInterceptor.java:71)
        at io.quarkus.hibernate.validator.runtime.interceptor.MethodValidationInterceptor.validateMethodInvocation(MethodValidationInterceptor.java:17)
        at io.quarkus.hibernate.validator.runtime.interceptor.MethodValidationInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:50)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:50)
        at io.quarkus.security.runtime.interceptor.SecurityHandler.handle(SecurityHandler.java:47)
        at io.quarkus.security.runtime.interceptor.SecurityHandler_Subclass.handle$$superforward1(Unknown Source)
        at io.quarkus.security.runtime.interceptor.SecurityHandler_Subclass$$function$$2.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
        at io.quarkus.security.runtime.interceptor.SecurityHandler_Subclass.handle(Unknown Source)
        at io.quarkus.security.runtime.interceptor.PermitAllInterceptor.intercept(PermitAllInterceptor.java:23)
        at io.quarkus.security.runtime.interceptor.PermitAllInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:50)
        at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:133)
        at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:104)
        at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
        at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:58)
        at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
        at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
        at hd.pie.graphql.IdentityGraphQLApi_Subclass.basicLogin(Unknown Source)
        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.smallrye.graphql.execution.datafetcher.helper.ReflectionInvoker.invoke(ReflectionInvoker.java:92)
        at io.quarkus.smallrye.graphql.runtime.spi.datafetcher.QuarkusDefaultDataFetcher.lambda$invokeAndTransformBlocking$0(QuarkusDefaultDataFetcher.java:77)
        at io.smallrye.context.impl.wrappers.SlowContextualCallable.call(SlowContextualCallable.java:21)
        at io.quarkus.smallrye.graphql.runtime.spi.datafetcher.BlockingHelper.lambda$runBlocking$0(BlockingHelper.java:30)
        at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
        at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
        at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
        at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
        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 org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

@phillip-kruger
Copy link
Member

@mkouba any thoughts?

@mkouba
Copy link
Contributor

mkouba commented Nov 4, 2022

I'm not sure but it could be a use case similar to the one I described in #27229 (comment), i.e. the ResteasyReactiveRequestContext.requestScopeDeactivated() sets the current request to null when suspended. CC @geoand

@geoand
Copy link
Contributor

geoand commented Nov 4, 2022

Indeed it might be the same. Can you try 2.14.0.Final which contains ca71dc9?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql area/kotlin kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

6 participants