quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.71k stars 2.66k forks source link

smallrye context propagation not usable without smallrye fault tolerance in 1.5.x #10248

Closed pschyma closed 4 years ago

pschyma commented 4 years ago

Describe the bug Context propagation does not work as described in the guide.

Expected behavior Following the context propagation guide by adding "io.quarkus:quarkus-smallrye-context-propagation" dependency should inject a ManagedExecutor into instances.

Actual behavior An exception is thrown at build step:

2020-06-25 07:45:29,192 ERROR [io.qua.dep.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.eclipse.microprofile.context.ManagedExecutor and qualifiers [@Default]
        - java member: x.Resource#<init>()
        - declared on CLASS bean [types=[de.comline.eis.excel.ExcelResource, java.lang.Object], qualifiers=[@Default, @Any], target=x.Resource]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:978)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:242)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:359)
        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:932)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Adding "io.quarkus:quarkus-smallrye-fault-tolerance" to the dependencies enables Quarkus to inject the executor.

To Reproduce Steps to reproduce the behavior:

  1. Configure a resource to use a managed executor and inject it (via constructor injection?).
  2. Build the project.

Configuration

quarkus:
  datasource:
    db-kind: mssql
    username: ..
    password: xxx
    jdbc:
      url: jdbc:sqlserver://localhost:1433

Environment (please complete the following information):

Additional context Works with 1.4.1.Final as expected.

kenfinnigan commented 4 years ago

@FroMage @Ladicek not sure if either of you has any thoughts on this?

Ladicek commented 4 years ago

:shrug:

pschyma commented 4 years ago

I've created a small reproducer [1]. While creating this, I noticed that it somehow depends on quarkus-flyway.

The reproducer can be changed to build (or start quarkusDev) by either:

[1] https://github.com/pschyma/quarkus-context-propagation-reproducer

pschyma commented 4 years ago

Just tried this with 1.6.0.CR1 and the project is built as expected.

gsmet commented 4 years ago

@pschyma so we can close this one?

pschyma commented 4 years ago

@gsmet I'd say: yes.

kenfinnigan commented 4 years ago

Thanks