Description
WIth the following broker plugins enabled:
<plugins> <loggingBrokerPlugin logAll="true" logConnectionEvents="false"/> <traceBrokerPathPlugin/> </plugins>
and network bridge down (only one broker up), the following error appears in the active broker log:
WARN - DiscoveryNetworkConnector - Could not start network bridge between: vm://broker1?async=false&network=true and: tcp://0.0.0.0:61627?soWriteTimeout=15000&soTimeout=15000&wireFormat.maxInactivityDuration=30000 due to: java.net.ConnectException: Connection refused WARN - DemandForwardingBridgeSupport - Caught an exception processing local command java.lang.NullPointerException at org.apache.activemq.broker.util.LoggingBrokerPlugin.removeBroker(LoggingBrokerPlugin.java:406) at org.apache.activemq.broker.MutableBrokerFilter.removeBroker(MutableBrokerFilter.java:195) at org.apache.activemq.broker.MutableBrokerFilter.removeBroker(MutableBrokerFilter.java:195) at org.apache.activemq.network.DemandForwardingBridgeSupport.stop(DemandForwardingBridgeSupport.java:339) at org.apache.activemq.network.DemandForwardingBridgeSupport.serviceLocalCommand(DemandForwardingBridgeSupport.java:718) at org.apache.activemq.network.DemandForwardingBridgeSupport$1.onCommand(DemandForwardingBridgeSupport.java:130) at org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.vm.VMTransport.stop(VMTransport.java:159) at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65) at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65) at org.apache.activemq.transport.ResponseCorrelator.stop(ResponseCorrelator.java:132) at org.apache.activemq.broker.TransportConnection.doStop(TransportConnection.java:991) at org.apache.activemq.broker.TransportConnection$4.run(TransportConnection.java:954) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680)
While this doesn't cause anything to break its not helpful to see these logs. The issue is that the DemandForwardingBridgeSupport stop method always calls removeBroker on the remote even if it never connected and the remote broker info is null. We should check this condition first before trying to remove something we never connected to.