How do I set Bamboo remote agent timeout?
Asked by Ashley Lewis:

How do I set the value of the "bamboo.agent.heartbeatTimeoutSeconds" property of an agent to "3600"?

I've tried adding it at "\<property name="bamboo.agent.heartbeatTimeoutSeconds"\>" to the bamboo-agent.cfg.xml file but the agents still timeout after 10 minutes.

I've tried starting my agent with the "-Dbamboo.agent.heartbeatTimeoutSeconds" commandline parameter but that throws an error "Error: Could not find or load main class .agent.heartbeatTimeoutSeconds".

I've tried setting it on the server bamboo.cfg.xml file.

I've even tried adding it to the Broker client URL in System General Configuration on the Bamboo server like this:  
failover:(tcp://bamboo.dev2.local:54663?wireFormat.maxInactivityDuration=1800000)?initialReconnectDelay=15000\&maxReconnectAttempts=60\&bamboo.agent.heartbeatTimeoutSeconds=3600  

Thank you for taking the time to read this question through. I just need the timeout to be 60 minutes instead of 10 while I wait for our networking infrastructure to be upgraded some time in 2019.

EDIT: I've tried the suggestion here: <https://community.atlassian.com/t5/Bamboo-questions/Can-I-set-a-longer-connection-timeout-for-Bamboo-remote-agents/qaq-p/95927> it looks similar to what i did with the Broker client URL in System General Configuration. But I still get this error:

```
FATAL [scheduler_Worker-4] [AgentContext] Agent encountered a fatal error: 'The last successful transmission was 10 minutes ago, the heartbeat timeout is 10 minutes, terminating agent'. Exiting.
java.util.concurrent.TimeoutException: The last successful transmission was 10 minutes ago, the heartbeat timeout is 10 minutes, terminating agent
 at com.atlassian.bamboo.v2.build.agent.remote.heartbeat.AgentHeartBeatJob.execute(AgentHeartBeatJob.java:57)
 at com.atlassian.bamboo.v2.build.agent.remote.heartbeat.AgentHeartBeatJob.execute(AgentHeartBeatJob.java:36)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
```

Also, I'd welcome any feedback at all. Other questions are being answered much faster than this question, clearly I have not been clear or succinct enough.


Answers:
author: Daniel Santos
body: Hi [@Ashley Lewis](/t5/user/viewprofilepage/user-id/84153),

I have a different suggestion for you which is more reliable according to our developers:

1. Change the broker back to its default value:

   ```
   failover:(tcp://<HOST_NAME>:<PORT>?wireFormat.maxInactivityDuration=300000)?initialReconnectDelay=15000&amp;maxReconnectAttempts=10
   ```

2. Make the adjustments on agent side by following the steps on this document: [Remote agent does not restart after server outage](https://confluence.atlassian.com/bamkb/remote-agent-does-not-restart-after-server-outage-213059795.html) (the values in that document will set the reconnect attempt time to 2h)  

   1. Stop the agent
   2. Edit **\<bamboo-agent-home\>/conf/wrapper.conf**
   3. Make sure*wrapper.successful_invocation_time* is set to 3  

      ```
      wrapper.successful_invocation_time=3
      ```

   4. Change *wrapper.max_failed_invocations* to 720

      ```
      wrapper.max_failed_invocations=720
      ```

   5. Start the agent  

      ?? Any agent with this configuration should attempt to reconnect for 1h in case the server is temporarily offline.

We also have a feature request to fix this behavior for all agents in future versions: [\[BAM-18608\] Increase the default time taken for the agents to reconnect in case the server is temporarily down](https://jira.atlassian.com/browse/BAM-18608)  

I hope you can apply this change to your agents.  
That will also allow you to set different reconnect time for different types of agents.

comments: author: Ashley Lewis
body: OK great, I've voted on BAM-18608!

Although, I am still confused. I can't find **\<bamboo-agent-home\>/conf/wrapper.conf** . None of my **\<bamboo-agent-home\>** directories contain a "conf" sub-directory, they all look like this:

plugins\\  
temp\\  
xml-data\\  
agentState\\  
caches\\  
classpath\\  
framework-bundles\\  
logs\\  
bamboo-agent.cfg.xml

My Bamboo server home looks like this:

plugins\\  
serverState\\  
temp\\  
templates\\  
xml-data\\  
analytics-logs\\  
artifacts\\  
backups\\  
caches\\  
DotNetSupport\\  
index\\  
jms-store\\  
logs\\  
bamboo.cfg.xml  
bamboo-mail.cfg.xml

Both my Bamboo server and agents log directories do not contain wrapper logs, only atlassian-bamboo.log, emergency-atlassian-bamboo.log and js-atlassian-bamboo.log. Could it be possible that I do not use a wrapper? I am using Windows 10 for my Bamboo agents and Windows Server 2016 for the server.

FYI, here is my Bamboo server install directory listing:  
atlassian-bamboo\\  
bin\\  
conf\\  
lib\\  
licenses\\  
logs\\  
scripts\\  
temp\\  
tomcat-docs\\  
tools\\  
webapps\\  
work\\  
bamboo.sh  
BambooConsole.bat  
BUILDING.txt  
CONTRIBUTING.md  
InstallAsService.bat  
NOTICE  
README.html  
README.md  
README.txt  
StartBamboo.bat  
StopBamboo.bat  
UninstallService.bat


author: Daniel Santos
body: .


author: Daniel Santos
body: Hi [@Ashley Lewis](/t5/user/viewprofilepage/user-id/84153),

I've checked both my windows and linux agents and they all have this folder. Could you share with me:

1. What is the version of Bamboo you are running?
2. What is the process used to install your remote agents?

comments: author: Ashley Lewis
body: Running Bamboo verison 6.7.2 build 60706 - 10 Dec 18.

To install a new remote Bamboo agent I went to https://\<my server domain\>/admin/agent/addRemoteAgent.action and downloaded a jar file onto the remote agent machine.

I run the agent like this:

```
"C:\Program Files\Java\bin\java.exe" -Dbamboo.home=C:\bamboo-home -jar C:\Builds\bamboo-agent-6.7.2.jar https://<my server domain>/agentServer/ console
```


author: Daniel Santos
body: Hi [@Ashley Lewis](/t5/user/viewprofilepage/user-id/84153),

I see what is happening. You are using the agent JAR directly without the wrapper. The page **Admin \>\> Agents \>\> Install remote agent**shares the command you should use for installing an agent. There you will see that we use the installer jar, not the one you are using at the moment.

This is the jar: **atlassian-bamboo-agent-installer-6.7.2.jar**

Your command should be like:

```
"C:\Program Files\Java\bin\java.exe" -Dbamboo.home=C:\bamboo-home -jar C:\Builds\bamboo-agent-installer-6.7.2.jar https://<my server domain>/agentServer/ console
```

By running the installer jar, the **conf** folder should be created (as it did in my last test on windows with Bamboo 6.7.2). Once you do that you should be able to use this command again with the new configuration set for **wrapper.conf**.


author: Ashley Lewis
body: OK the wrapper is working for me now so I'm marking this as answered. But I should mention I had to check this box to allow UI testing with my Bamboo agent:  
![interactivesservice.png](https://community.atlassian.com/t5/image/serverpage/image-id/40952i323E11A27CA9E2F8/image-size/large?v=v2&px=999 "interactivesservice.png")


author: Daniel Santos
body: Hi [@Ashley Lewis](/t5/user/viewprofilepage/user-id/84153),

Thank you for sharing it. That will probably help others that are running the agent as a service.

I've changed the accepted answer to our first thread. I wrongly created a second thread when answering you. This could create confusion for other users coming to this question.  

Thank you for sharing all the issue details with us here.   
I'm glad we could find what was wrong together.

Have a good one!