You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/08/10 08:59:22 UTC

[GitHub] [camel-quarkus] jamesnetherton opened a new issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

jamesnetherton opened a new issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002


   Not sure what's going on with this. In the failure case, a bunch of `RouteBuilder` impls have been found via `registry.findByType(CamelContextAware.class)` and they all have a null `CamelContext`. On success they never show up in the registry lookup at all.
   
   I can't replicate this locally. Maybe its related to the order of test execution.
   
   ```
   2021-08-10T01:10:42.5347701Z 2021-08-10 01:10:42,525 WARN  [org.apa.cam.qua.cor.CoreResource] (executor-thread-1) Found a CamelContextAware bean of type org.apache.camel.quarkus.core.languages.it.CustomDataFormatRoutes with null CamelContext
   2021-08-10T01:10:42.5352909Z 2021-08-10 01:10:42,525 WARN  [org.apa.cam.qua.cor.CoreResource] (executor-thread-1) Found a CamelContextAware bean of type org.apache.camel.quarkus.component.bean.RouteBuilderWithProducer with null CamelContext
   2021-08-10T01:10:42.5357507Z 2021-08-10 01:10:42,525 WARN  [org.apa.cam.qua.cor.CoreResource] (executor-thread-1) Found a CamelContextAware bean of type org.apache.camel.quarkus.core.languages.it.RefLanguageRoutes with null CamelContext
   2021-08-10T01:10:42.5361434Z 2021-08-10 01:10:42,525 WARN  [org.apa.cam.qua.cor.CoreResource] (executor-thread-1) Found a CamelContextAware bean of type org.apache.camel.quarkus.eip.it.EipRoutes with null CamelContext
   2021-08-10T01:10:42.5365142Z 2021-08-10 01:10:42,525 WARN  [org.apa.cam.qua.cor.CoreResource] (executor-thread-1) Found a CamelContextAware bean of type org.apache.camel.quarkus.component.bean.eip.EipRoutes with null CamelContext
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-900596035


   It took me some time till I realized that RouteBuilder became CamelContextAware very recently through this change: https://github.com/apache/camel/commit/148ce23162cd59b4c9548f00175f1749fac06d30#diff-f5f5e129daa69bcc30b62eac7c3ef1dffd748c1da3637d9c9d724d3ce8a316ccR40
   This can thus only be reproduced with our camel-main branch


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-901817107


   The real cause is a little bit different than my original guess. As I assumed, there are two instances of the builder per class: one with context set properly, and one with no context. But it is not because one is created by us and the other one by Arc. Both are created by Arc and it is correct so. Because the builder class has no explicit CDI scope, it gets the default `@Dependent` pseudo-scope. That basically means that each lookup or injection gives a new instance. Listing container beans once (when adding builders to the context) gives another instance than when listing them second time (when checking that they have context set).
   
   I wonder what contract was the test actually supposed to check? I am not aware that we promise auto-setting the context to each and every bean (including end user ones) that implements `CamelContextAware`. Yes, we set the context on the RouteBuilders and perhaps also in some other special cases, but there's no general contract about that, is there?
   
   Perhaps we just wanted to make sure that all RouteBuilders managed by Arc get the context set properly? If so, then the test should IMO lookup only some specific RouteBuilder bean that we fix to have proper scope set.
   
   While having RouteBuilders in `@Dependent` scope is perhaps mostly not a good idea, I am still not quite sure we should introduce any measures to prevent/warn about it. WDYT?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] jamesnetherton commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-900872463


   > Also my hypothesis seems to work: the problem disappears when the RoutesBuilder is annotated with some Bean defining annotation, e.g. `@ApplicationScoped`.
   
   Are you planning to provide a fix on `camel-main`? I'd like to have that branch building again so that we know where things stand.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-900627302


   Indeed, it is reproducible in camel-main with a test like this https://github.com/ppalaga/camel-quarkus/commit/fc0834439bb782137a84264f63fbfd9fe0c64888 Also my hypothesis seems to work: the problem disappears when the RoutesBuilder is annotated with some Bean defining annotation, e.g. `@ApplicationScoped`. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga closed issue #3002: `CoreTest.testCamelContextAwareRegistryBeansInitialized` failing after RouteBuilder started implementing CamelContextAware

Posted by GitBox <gi...@apache.org>.
ppalaga closed issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] jamesnetherton commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-900872463


   > Also my hypothesis seems to work: the problem disappears when the RoutesBuilder is annotated with some Bean defining annotation, e.g. `@ApplicationScoped`.
   
   Are you planning to provide a fix on `camel-main`? I'd like to have that branch building again so that we know where things stand.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-901818748


   > Perhaps we just wanted to make sure that all RouteBuilders managed by Arc get the context set properly? 
   
   This was surely not the original intention of the test. RouteBuilder did not implement CamelContextAware at that time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-901853619


   Digging a bit more into the implementation if the Registry and what CamelContextAware beans are there, I'd say that the idea behind the test was to ensure that the CamelContextAware items in the fallbackRegistry have context set, not the ones managed by Arc. Let me propose a fix to the test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-900454707


   Observation: All of those RouteBuilders contain at least one bean producer method, although they themselves do not bear any Bean defining annotation. 
   Hypothesis (without checking any code): Arc handles them as beans because of those methods, but we (mistakenly) do not consider them as managed by Arc. As a result of that two instances of each of those Builders exist at runtime. One auto-created by Arc and one created by our recorder. Let me investigate more.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: Intermittent failure of `CoreTest.testCamelContextAwareRegistryBeansInitialized`

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-900454707






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #3002: `CoreTest.testCamelContextAwareRegistryBeansInitialized` failing after RouteBuilder started implementing CamelContextAware

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-905326163


   > Can we also cherrypick this fix to camel-main branch?
   
   Given that the fix was merged to main, cherry-picking to camel-main should not be necessary. camel-main may need rebasing on top of main though.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ffang commented on issue #3002: `CoreTest.testCamelContextAwareRegistryBeansInitialized` failing after RouteBuilder started implementing CamelContextAware

Posted by GitBox <gi...@apache.org>.
ffang commented on issue #3002:
URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-904950917


   Hi @ppalaga ,
   
   Can we also cherrypick this fix to camel-main branch?
   
   Thanks!
   Freeman


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org