codecentric / chaos-monkey-spring-boot

Chaos Monkey for Spring Boot
https://codecentric.github.io/chaos-monkey-spring-boot/
Apache License 2.0
912 stars 171 forks source link

Chaos Monkey integration with webflux and reactor core #76

Closed vivekajm closed 5 years ago

vivekajm commented 5 years ago

Hi, we try using version 2.0.2 version of chaos mokey with our application. ### We are using Spring Webflux (reactive web programing) + Reactor core (Reactor Netty), the spring boot version is (2.1.5.RELEASE) but I am getting exception from the service, without chaos monkey dependency it is working fine. I am suspecting whether Chaos Monkey supports reactive programming or not. Below are the exception can you please help.

[DEBUG] org.springframework.context.annotation.AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@15d943d, started on Tue Jun 25 11:09:47 GST 2019 [ERROR] org.springframework.boot.SpringApplication - Application run failed org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryConfiguration$EmbeddedNetty': Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'de.codecentric.spring.boot.chaos.monkey.configuration.ChaosMonkeyConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'chaos.monkey-de.codecentric.spring.boot.chaos.monkey.configuration.ChaosMonkeyProperties': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'componentAspect': Requested bean is currently in creation: Is there an unresolvable circular reference? at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:82) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:67) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at com.emirates.ocsl.profileservice.Application.main(Application.java:30)

vivekajm commented 5 years ago

@MrBW Can you please confirm whether Chaos Monkey Supports WebFlux or not , I am still getting the initialisation bean error, as per my investigation to resolve cyclic dependency we have to @Lazy initialise one of the bean which is failing.

I believe that below constructor injection is failing because of this we are getting the error. Can you please help to resolve the issue.

public ChaosMonkeyConfiguration(ChaosMonkeyProperties chaosMonkeyProperties, WatcherProperties watcherProperties, AssaultProperties assaultProperties) { this.chaosMonkeyProperties = chaosMonkeyProperties; this.watcherProperties = watcherProperties; this.assaultProperties = assaultProperties; try { String chaosLogo = StreamUtils.copyToString(new ClassPathResource("chaos-logo.txt").getInputStream(), Charset.defaultCharset()); LOGGER.info(chaosLogo); } catch (IOException e) { LOGGER.info("Chaos Monkey - ready to do evil"); } }

vivekajm commented 5 years ago

@MrBW
the issue occur only when I tried to inject (chaos.monkey.watcher.### component=true), i believe that chaosMonkeyConfiguration for this particular version is not able to inject the dependency.

Note: we are using version 2.0.2 version of chaos mokey with our application. ### We are using Spring Webflux (reactive web programing) + Reactor core (Reactor Netty), the spring boot version is (2.1.5.RELEASE)

maiksensi commented 5 years ago

Is this a duplicate of #57 ?

maiksensi commented 5 years ago

@MrBW updated the spring boot version in the referenced PR. I guess this will be resolved with the next release.

maiksensi commented 5 years ago

This should be tackled in the next release. Closing this for now. Feel free to open it again if this is not fixed with the next release.