-
Notifications
You must be signed in to change notification settings - Fork 632
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
fix(core): remove circular reference from CanaryJudgeTask, CompareJudgeResultsTask, MetricSetMixerServiceTask, MonitorCanaryTask and RunCanaryTask classes identified during upgrade to spring boot 2.6.x #1022
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@j-sandy This feels more like a fix than a refactor...and since the changes are in src/main instead of src/test, I'd leave that out of the commit message...but I'm not sure what the right prefix is... |
…geResultsTask, MetricSetMixerServiceTask, MonitorCanaryTask and RunCanaryTask classes identified during upgrade to spring boot 2.6.x While upgrading spring boot 2.6.15 and spring cloud 2021.0.8, encountered below errors in kayenta-integration-tests module during test execution and 8 tests failed with similar error: ``` Failed to load ApplicationContext java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138) ... Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisOrcaQueueConfiguration': Unsatisfied dependency expressed through method 'redisQueueObjectMapper' parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskResolver' defined in class path resource [com/netflix/spinnaker/orca/config/OrcaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.spinnaker.orca.TaskResolver]: Factory method 'taskResolver' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'canaryJudgeTask' defined in URL [jar:file:/kayenta/kayenta-core/build/libs/kayenta-core.jar!/com/netflix/kayenta/canary/orca/CanaryJudgeTask.class]: Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'executionMapper' defined in URL [jar:file:/kayenta/kayenta-core/build/libs/kayenta-core.jar!/com/netflix/kayenta/canary/ExecutionMapper.class]: Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'executionLauncher' defined in URL [jar:file:/.m2/repository/io/spinnaker/orca/orca-core/sc202108-sb2615-SNAPSHOT/orca-core-sc202108-sb2615-SNAPSHOT.jar!/com/netflix/spinnaker/orca/pipeline/ExecutionLauncher.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueExecutionRunner' defined in URL [jar:file:/.m2/repository/io/spinnaker/orca/orca-queue/sc202108-sb2615-SNAPSHOT/orca-queue-sc202108-sb2615-SNAPSHOT.jar!/com/netflix/spinnaker/orca/q/QueueExecutionRunner.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'redisOrcaQueueConfiguration': Requested bean is currently in creation: Is there an unresolvable circular reference? at app//org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:768) at app//org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:720) at app//org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) at app//org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at app//org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at app//org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at app//org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at app//org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) at app//org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920) at app//org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at app//org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) at app//org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745) at app//org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:423) at app//org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at app//org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:148) at app//org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:141) at app//org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:90) ... 88 more ``` And the logs were showing below details about circular reference: ``` 2024-02-16 23:00:59.572 ERROR 833552 --- [ Test worker] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: The dependencies of some of the beans in the application context form a cycle: ┌─────┐ | redisOrcaQueueConfiguration ↑ ↓ | taskResolver defined in class path resource [com/netflix/spinnaker/orca/config/OrcaConfiguration.class] ↑ ↓ | canaryJudgeTask defined in URL [jar:file:/kayenta/kayenta-core/build/libs/kayenta-core.jar!/com/netflix/kayenta/canary/orca/CanaryJudgeTask.class] ↑ ↓ | executionMapper defined in URL [jar:file:/kayenta/kayenta-core/build/libs/kayenta-core.jar!/com/netflix/kayenta/canary/ExecutionMapper.class] ↑ ↓ | executionLauncher defined in URL [jar:file:/.m2/repository/io/spinnaker/orca/orca-core/sc202108-sb2615-SNAPSHOT/orca-core-sc202108-sb2615-SNAPSHOT.jar!/com/netflix/spinnaker/orca/pipeline/ExecutionLauncher.class] ↑ ↓ | queueExecutionRunner defined in URL [jar:file:/.m2/repository/io/spinnaker/orca/orca-queue/sc202108-sb2615-SNAPSHOT/orca-queue-sc202108-sb2615-SNAPSHOT.jar!/com/netflix/spinnaker/orca/q/QueueExecutionRunner.class] └─────┘ Action: Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true. ``` Similar errors were reported for CanaryJudgeTask, CompareJudgeResultsTask, MetricSetMixerServiceTask, MonitorCanaryTask and RunCanaryTask classes, until fixed for each one of them. In order to fix the issue, deferred the initialization by using @lazy annotation for above mentioned classes.
j-sandy
force-pushed
the
remove-circular-ref
branch
from
February 20, 2024 04:32
835d244
to
1d73441
Compare
j-sandy
changed the title
refactor(integration/test): remove circular reference from CanaryJudgeTask, CompareJudgeResultsTask, MetricSetMixerServiceTask, MonitorCanaryTask and RunCanaryTask classes identified during upgrade to spring boot 2.6.x
fix(core): remove circular reference from CanaryJudgeTask, CompareJudgeResultsTask, MetricSetMixerServiceTask, MonitorCanaryTask and RunCanaryTask classes identified during upgrade to spring boot 2.6.x
Feb 20, 2024
Update the commit and title of PR. |
dbyron-sf
approved these changes
Feb 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While upgrading spring boot 2.6.15 and spring cloud 2021.0.8, encountered below errors in kayenta-integration-tests module during test execution and 8 tests failed with similar error:
And the logs were showing below details about circular reference:
Similar errors were reported for CanaryJudgeTask, CompareJudgeResultsTask, MetricSetMixerServiceTask, MonitorCanaryTask and RunCanaryTask classes, until fixed for each one of them.
In order to fix the issue, deferred the initialization by using
@Lazy
annotation for above mentioned classes.