When Windows Server restarts, build agent service doesn't restart and is marked as "needs upgrade" in web UI
Hi,
When our Windows Server 2008 R2 server that hosts the TeamCity web site and a build agent restarts (typically due to Windows Updates), the build agent doesn't come back up when the server is restarted. This results in the message "Agent has unregistered (will upgrade)" to appear alongside its entry on the Agents list.
This requires a manual upgrade to be performed, so:
- (Make sure Windows Service is stopped - it usually hasn't stopped, so the Windows Service comes up, but not the functionality of the build agent)
- In a Windows console (buildAgent/bin folder), enter: AGENT START
- Wait for the console to calm down
- Wait for TeamCity UI to acknowledge the build agent
- Stop the build agent, in a Windows console, enter: AGENT STOP
- Wait
- Restart the Windows Service
- Wait for the TeamCity UI to acknowledge the build agent
As you can imagine, this is very frustrating and is removing the benefit of the build server.
How can we correct this?
Thanks
Nathan
Please sign in to leave a comment.
Hi Nathan,
most often, this issue happens when the service runs with a user that doesn't have enough permissions to perform the upgrade. If the server needs to send some updated information to the agent that requires a restart of the agent for upgrade, the service will do it and will need to write information to the full agent folder, not just the work folder, so it needs full rw access to it.
If this doesn't help, please use the submit a request button above and send us the teamcity-agent.log and upgrade.log files from the agent, retrieved after a server restart and the agent has entered the "agent has unregistered (will upgrade)" message (preferably give it a few minutes so that it actually tries to upgrade)
Thanks Denis.
I've applied RW permissions to the service user as you suggest. That makes sense, we'll see how that goes. Thanks very much for that.
But that raises the question, why does a server restart instigate an upgrade every time? Am I to understand it isn't an "upgrade" as one would understand it for the purposes of upgrade, more a pushing of information which is implemented as an upgrade?
Hi Nathan,
Sorry i didn't answer sooner. While I agree that it doesn't make sense, this isn't a common scenario. It shouldn't happen at all, only when server and agent version don't match or new plugins are installed. Other than that, it shouldn't really need a restart.