Hi all,
We have a forwarding bridge between an embedded broker in one VM and a remote
broker in another VM using the examples from the network-of-brokers
documentation[1]. While testing failover, we left the embedded broker VM
running overnight but did not start the remote broker VM. NOTE: The embedded
broker VM was idle (we were not testing application logic).
In the morning the embedded broker VM threw an OutOfMemoryError:
Exception in thread "Simple Discovery Agent:
java.util.concurrent.threadpoolexecutor$wor...@61472b3c"
java.lang.OutOfMemoryError: Java heap space
at
org.apache.activemq.openwire.OpenWireFormat.<init>(OpenWireFormat.java:60)
at
org.apache.activemq.openwire.OpenWireFormat.<init>(OpenWireFormat.java:69)
at
org.apache.activemq.openwire.OpenWireFormatFactory.createWireFormat(OpenWireFormatFactory.java:62)
at
org.apache.activemq.transport.TransportFactory.createWireFormat(TransportFactory.java:212)
at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:140)
at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:67)
at
org.apache.activemq.network.DiscoveryNetworkConnector.onServiceAdd(DiscoveryNetworkConnector.java:111)
at
org.apache.activemq.transport.discovery.simple.SimpleDiscoveryAgent$1.run(SimpleDiscoveryAgent.java:164)
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:637)
Our logs contained repeated (and expected) messages indicating that a
connection could not be established with the remote broker. The one thing that
stands out from these logs is that a new thread was created in the embedded
broker VM on each attempt to connect to the remote broker VM:
[1259881226751][Thread-10] Could not start network bridge between:
vm://embeddedBroker and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
[1259881227757][Thread-11] Could not start network bridge between:
vm://embeddedBroker and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
[1259881229762][Thread-12] Could not start network bridge between:
vm://embeddedBroker and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
...
[1259888976178][Thread-267] Could not start network bridge between:
vm://embeddedBroker and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
[1259889006398][Thread-268] Could not start network bridge between:
vm://embeddedBroker and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
[1259889036611][Thread-269] Could not start network bridge between:
vm://embeddedBroker and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
The embedded broker VM is configured via Spring as follows:
<amq:broker id="embeddedBroker" brokerName="embeddedBroker"
useJmx="true" persistent="false" useShutdownHook="true">
<amq:managementContext>
<amq:managementContext createConnector="false"/>
</amq:managementContext>
<amq:networkConnectors>
<amq:networkConnector
uri="static:(tcp://localhost:61616)"/>
</amq:networkConnectors>
</amq:broker>
Any help would be greatly appreciated.
Thanks,
Geoff.
[1] http://activemq.apache.org/networks-of-brokers.html