Agent remains in loading: "java.net.BindException: Address already in use"

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

Agents are not connecting and but the server is able to see them loading.

From Cog icon >> Overview >> Agents >> Online remote agents (tab) the following message can be seen:

1 Nov 12, 2017 2:55:32 PM A remote agent is loading on 192.168.1.203 (127.0.0.1).

Diagnosis

One of the possible causes could be the address already in use. If this is the case the following can be found in the server logs:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 2017-11-12 14:48:44,686 ERROR [localhost-startStop-1] [BambooBrokerService] Unable to start JMS connector at nio://0.0.0.0:54663?wireFormat.maxInactivityDuration=300000 java.io.IOException: Failed to bind to server socket: nio://0.0.0.0:54663?wireFormat.maxInactivityDuration=300000 due to: java.net.BindException: Address already in use at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:34) at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:143) at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:62) at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40) at org.apache.activemq.broker.BrokerService.createTransportConnector(BrokerService.java:2478) at org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:338) at com.atlassian.bamboo.amq.BambooBrokerService.startConnector(BambooBrokerService.java:128) at com.atlassian.bamboo.amq.BambooBrokerService.addStartedConnectors(BambooBrokerService.java:108) at com.atlassian.bamboo.buildqueue.manager.RemoteAgentManagerImpl.startOrStopConnectors(RemoteAgentManagerImpl.java:422) at com.atlassian.bamboo.buildqueue.manager.RemoteAgentManagerImpl.start(RemoteAgentManagerImpl.java:539) at com.atlassian.bamboo.container.BambooContainer.start(BambooContainer.java:265) at com.atlassian.bamboo.upgrade.UpgradeLauncher.upgradeAndStartBamboo(UpgradeLauncher.java:131) at com.atlassian.bamboo.upgrade.UpgradeLauncher.contextInitialized(UpgradeLauncher.java:42) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.activemq.transport.nio.NIOTransportFactory$2.createServerSocket(NIOTransportFactory.java:83) at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:140) ... 20 more

Cause

This mostly happens when two instances of Bamboo are running on the same server. It could be the case of having both production and development instances with broker configured to listen on 54663.

In cases where there is only one Bamboo instance and binding error still remains, the netstat command can be helpful.

The following can be used to diagnose what process is holding the port:

OS

Command

Windows

netstat-an | findstr54663

Unix like

netstat -an | grep 54663

Solution

Resolution

  1. Shutdown the instance with the error Address already in use

  2. Edit the <Bamboo_Home>/bamboo.cfg.xml file and update the port in the following two lines:

    1 2 <property name="bamboo.jms.broker.client.uri">failover:(tcp://bamboo_server_host:54663?wireFormat.maxInactivityDuration=300000)?maxReconnectAttempts=10&amp;initialReconnectDelay=15000</property> <property name="bamboo.jms.broker.uri">tcp://0.0.0.0:54663?wireFormat.maxInactivityDuration=300000</property>

    This change can be performed also from the Bamboo UI (Cog icon >> Overview >> General configuration) in versions above 5.x.

  3. Restart your Bamboo server for the changes to take effect.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.