Skip to content

NPE found when rabbitmq event bus is configured with cloudstack #12634

@kiranchavala

Description

@kiranchavala

problem

NPE found when rabbitmq event bus is configured

versions

ACS 4.22

The steps to reproduce the bug

  1. Configure Rabbitma event bus

https://docs.cloudstack.apache.org/en/4.22.0.0/adminguide/events.html#amqp-configuration

  1. Stop the rabbit mq server

  2. Stop the cloudstack-management server

  3. Check the logs


2026-02-12 06:05:07,916 ERROR [o.a.c.s.l.CloudStackExtendedLifeCycle] (SpringContextShutdownHook:[]) (logid:) Error on stopping bean RabbitMQEventBus - Cannot invoke "com.rabbitmq.client.Connection.isOpen()" because "org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus.s_connection" is null java.lang.NullPointerException: Cannot invoke "com.rabbitmq.client.Connection.isOpen()" because "org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus.s_connection" is null
        at org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus.stop(RabbitMQEventBus.java:496)
        at org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle$2.with(CloudStackExtendedLifeCycle.java:103)
        at org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.with(CloudStackExtendedLifeCycle.java:163)
        at org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.stopBeans(CloudStackExtendedLifeCycle.java:98)
        at org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycleStart.stop(CloudStackExtendedLifeCycleStart.java:27)
        at org.apache.cloudstack.spring.lifecycle.AbstractSmartLifeCycle.stop(AbstractSmartLifeCycle.java:52)
        at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:234)
        at org.springframework.context.support.DefaultLifecycleProcessor.access$300(DefaultLifecycleProcessor.java:54)
        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:373)
        at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:206)
        at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:129)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1069)
        at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:993)

What to do about it?

Cloudstack should check rabbitmq connectivity when stopping the service

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions