Agent has unregistered (will upgrade)

I have teamcity server running on Red hat x64 and I have one default build agent on it, and it seemed all should work, but agent is permanently disconnected.
I've checked some topicks here and googled, but cann't understand what the matter. We havn't any antiviruses to block agent upgrading. I've reinstalled server and tried other version, but still getting the issue.
Could you please take a look at this:

[2014-05-28 13:51:23,740]   INFO -    jetbrains.buildServer.AGENT - Start build agent
[2014-05-28 13:51:23,759]   INFO -    jetbrains.buildServer.AGENT - Agent Web server started on port 9090
[2014-05-28 13:51:23,761]   INFO - ctories.CleanupRegistryCleaner - Removing files from .old to meet free space requirements.
[2014-05-28 13:51:23,776]   INFO - agent.impl.AgentDetailsFactory - Build agent ownAddress will be defined by the server. Define 'ownAddress' property in the conf/buildAgent.properties file
[2014-05-28 13:51:23,807]   INFO - buildServer.AGENT.registration - Registering on server http://localhost:8111, AgentDetails{Name='Default Agent', AgentId=null, BuildId=null, AgentOwnAddress='null', AlternativeAddresses=[209.1$
[2014-05-28 13:51:23,915]   INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2014-05-28 13:51:24,057]   INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /home/katya/TeamCity/buildAgent/logs/buildAgent.port
[2014-05-28 13:51:24,058]   INFO - agent.impl.AgentPortFileWriter - Launcher version is 29939
[2014-05-28 13:51:24,059]   INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /home/katya/TeamCity/buildAgent/logs/buildAgent.port :DONE!
[2014-05-28 13:51:24,064]   INFO -    jetbrains.buildServer.AGENT - Build agent started
[2014-05-28 13:51:24,190]   INFO -    jetbrains.buildServer.AGENT - Upgrade call received from the build server
[2014-05-28 13:51:24,193]   INFO -    jetbrains.buildServer.AGENT - Will upgrade when become idle
[2014-05-28 13:51:24,196]   INFO -    jetbrains.buildServer.AGENT - Wait for build agent registration to finish
[2014-05-28 13:51:24,231]   INFO - buildServer.AGENT.registration - Registered: id:1, authorizationToken:8bf1acb43eb6be1f63bcf8333fe7ffb1
[2014-05-28 13:51:24,232]   INFO - buildServer.AGENT.registration - If this is the first time this agent registered on the server make sure it is authorized by administrator in the server web UI.
[2014-05-28 13:51:24,233]   INFO -    jetbrains.buildServer.AGENT - Registration of build agent is finished.
[2014-05-28 13:51:24,235]   INFO -    jetbrains.buildServer.AGENT - Stop command was not performed. No build to stop with reason: BuildInterruptReason.AGENT_SHUTDOWN
[2014-05-28 13:51:24,235]   INFO -    jetbrains.buildServer.AGENT - Starting agent shutdown sequence, reason: Restart agent, failed to download upgrade from server
[2014-05-28 13:51:24,241]   INFO -    jetbrains.buildServer.AGENT - Host configuration for downloading updates: HostConfiguration[host=http://localhost:8111]
[2014-05-28 13:51:24,241]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8111/update/teamcity-agent.xml ==> /home/katya/TeamCity/buildAgent/temp/iKbl16mSJdedXSe5QK6aLd77xkmct2WC
....
[2014-05-28 13:51:29,184]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8111/update/plugins/jps.zip ==> /home/katya/TeamCity/buildAgent/update/plugins/jps.zip
[2014-05-28 13:51:29,254]   WARN -   jetbrains.buildServer.SERVER - Waiting for update agent properties pool to complete
[2014-05-28 13:51:29,256]   INFO - agent.impl.AgentPortFileWriter - Delete agent runtime file from /home/katya/TeamCity/buildAgent/logs/buildAgent.port
[2014-05-28 13:51:29,257]   INFO -    jetbrains.buildServer.AGENT - Unregistering from the server. Agent id: 1
[2014-05-28 13:51:29,271]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent WebServer start
[2014-05-28 13:51:29,272]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent WebServer finish
[2014-05-28 13:51:29,272]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent finish
[2014-05-28 13:51:29,589]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8111/update/plugins/junitPlugin.zip ==> /home/katya/TeamCity/buildAgent/update/plugins/junitPlugin.zip
...
[2014-05-28 13:51:30,989]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8111/update/buildAgent.zip ==> /home/katya/TeamCity/buildAgent/update/buildAgent.zip
[2014-05-28 13:51:31,676]   INFO -    jetbrains.buildServer.AGENT - Upgrade mode: jetbrains.buildServer.agent.impl.upgrade.modes.FullUpgradeMode
[2014-05-28 13:51:31,688]   INFO - rocesses.ProcessTreeTerminator - Using jetbrains.buildServer.processes.ProcessTreeTerminatorLinux
[2014-05-28 13:51:31,870]   INFO - ses.ProcessTreeTerminatorLinux - Second thread id is 24478
[2014-05-28 13:51:31,870]   INFO - ses.ProcessTreeTerminatorLinux - Thread is Process thread model: false
[2014-05-28 13:51:31,872]   INFO - .ProcessTreeTerminatorImplBase - No processes to kill
[2014-05-28 13:51:31,872]   INFO -    jetbrains.buildServer.AGENT - Exit for upgrade
[2014-05-28 13:51:31,873]   INFO - ent.impl.upgrade.AgentExitCode - Agent exited. Upgrade process
[2014-05-28 13:51:31,874]   INFO - buildServer.agent.AgentMain2$2 - Closing jetbrains.buildServer.agent.AgentMain2$2@113cefe: startup date [Wed May 28 13:51:01 UTC 2014];

0
7 comments

please attach complete teamcity-agent.log

0
Avatar
Permanently deleted user

here it is



Attachment(s):
teamcity-agent.log.zip
0

The agent wasn't able to update itself properly. Please attach launcher.log and upgrade.log as well. Also, please ensure that user that starts buildagent has write access to its own directory.

0
Avatar
Permanently deleted user

That's strange,but I revealed two directories without write access for the user - /temp & /update. I've deleted them, restarted agent.sh, but the problem didn't disappear.
Launcher log is attached. Look please



Attachment(s):
launcher.log.zip
0

It looks like the launcher process cannot stop itself. It calls /bin/sh ./agent.sh stop kill from the agent/bin folder and hangs here.

Please check the permissions.

0
Avatar
Permanently deleted user

Change the Logon on the windows service to use Local System account, restart, then the agent will upgrade, afterwards you can change back to whatever user you want to logon as

0

Thanks for pointing me onto the right track, permanently deleted user! There is no need to run as LocalSystem - it's enough to give the special SERVICE user permission to start and stop the service:

(I did this using Process Hacker, but other tools that can edit service permissions will work.)

https://youtrack.jetbrains.com/issue/TW-91756/Windows-agent-service-does-not-have-permission-to-restart-itself

0

Please sign in to leave a comment.