Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

chaos monkey should work without hubot running; it can just not notify a chat room if there's no hubot service running #4647

Closed
jstrachan opened this issue Aug 24, 2015 · 8 comments · Fixed by #4661

Comments

@jstrachan
Copy link
Contributor

No description provided.

@bkonetzny
Copy link

I tried to run the chaos monkey as a standalone replication controller in our kubernetes stack without any other fabric8 components:

{
    "kind": "ReplicationController",
    "apiVersion": "v1",
    "id": "chaos-monkey",
    "spec": {
        "replicas": 1,
        "template": {
            "spec": {
                "containers": [
                    {
                        "name": "chaos-monkey",
                        "image": "fabric8/chaos-monkey:2.2.22"
                    }
                ]
            }
        }
    }
}

When the docker container starts, I get the following exception:

Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions:
Exception 0 :
java.lang.IllegalStateException: Could not find client beans!
        at io.fabric8.cdi.KubernetesHolder.getClient(KubernetesHolder.java:40)
        at io.fabric8.cdi.Services.toServiceUrl(Services.java:37)
        at io.fabric8.cdi.producers.ServiceUrlProducer.produce(ServiceUrlProducer.java:47)
        at io.fabric8.cdi.producers.ServiceUrlProducer.produce(ServiceUrlProducer.java:26)
        at io.fabric8.cdi.bean.ProducerBean.create(ProducerBean.java:42)
        at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:761)
        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:861)
        at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:76)
        at org.jboss.weld.injection.ConstructorInjectionPoint.getParameterValues(ConstructorInjectionPoint.java:150)
        at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:75)
        at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)
        at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:116)
        at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:179)
        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
        at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:761)
        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:861)
        at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:76)
        at org.jboss.weld.injection.ConstructorInjectionPoint.getParameterValues(ConstructorInjectionPoint.java:150)
        at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:75)
        at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)
        at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:116)
        at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:179)
        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
        at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
        at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
        at io.fabric8.chaos.monkey.ChaosMonkey$Proxy$_$$_WeldClientProxy.toString(Unknown Source)
        at io.fabric8.cdi.eager.EagerCDIExtension.afterDeploymentValidation(EagerCDIExtension.java:42)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
        at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.jav
        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:306)
        at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:121)
        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:284)
        at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:262)
        at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:271)
        at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:260)
        at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:154)
        at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:148)
        at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:54)
        at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
        at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
        at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:447)
        at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
        at org.jboss.weld.environment.se.Weld.initialize(Weld.java:143)
        at org.jboss.weld.environment.se.StartMain.go(StartMain.java:48)
        at org.jboss.weld.environment.se.StartMain.main(StartMain.java:58)

        at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:37)
        at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
        at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:447)
        at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
        at org.jboss.weld.environment.se.Weld.initialize(Weld.java:143)
        at org.jboss.weld.environment.se.StartMain.go(StartMain.java:48)
        at org.jboss.weld.environment.se.StartMain.main(StartMain.java:58)

Is this related to the missing hubot service? Not sure about this as I don't pass any ENV vars.

@jstrachan
Copy link
Contributor Author

yeah - thats the missing Hubot service; the error should be a bit more clear which service is missing ;)

Lets try fix that error message too!

@jstrachan
Copy link
Contributor Author

This is the injection we should make optional so that the HubotNotifier is a NOOP if folks are not running it:
https://github.com/jstrachan/fabric8/blob/cdelivery/components/hubot-api/src/main/java/io/fabric8/hubot/HubotNotifier.java#L49-49

@bkonetzny
Copy link

I think it should default to logging messages to stdout and only optional to hubot, so log collection services can pick up the work done by this chaos monkey.

@jstrachan
Copy link
Contributor Author

@bkonetzny agreed!

@jstrachan
Copy link
Contributor Author

I raised a separate issue for the error message being confusing to not list the missing service: #4648

@iocanel iocanel self-assigned this Aug 25, 2015
@iocanel
Copy link
Member

iocanel commented Aug 25, 2015

As mentioned in #4648 the error message doesn't have to do with service availability but with a bug in the client lookup.

In any case, I added support for Instance injection, which allows handling of optional dependencies.

@iocanel iocanel closed this as completed Aug 25, 2015
@jstrachan jstrachan reopened this Aug 25, 2015
@jstrachan jstrachan assigned jstrachan and unassigned iocanel Aug 25, 2015
@jstrachan
Copy link
Contributor Author

now lemme make hubot-notifier agnostic on whether hubot is running or not...

jstrachan added a commit to jstrachan/fabric8 that referenced this issue Aug 25, 2015
…ected and used; even if no hubot REST service is running (and log a warning, otherwise keep running and log the chat messages that would have been sent)
jstrachan added a commit to jstrachan/fabric8 that referenced this issue Aug 26, 2015
…hen hubot is running; plus when its not running and just log a warning on startup along with using standard output
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.