Server thinks agent is localhost

I am having issues connecting an agent to the server.  I am using TC 6.5 EAP.  The server is running on Windows and the agent is running on CentOS.  My agent properties file looks like this:

serverUrl=http://tcserver.domain.local
name=tcagent1.domain.local
workDir=../work
tempDir=../temp
systemDir=../system
ownAddress=tcagent1.domain.local
ownPort=9090
authorizationToken=...snip...



In the agent logs:

[2011-02-26 15:38:23,516]   INFO - buildServer.AGENT.registration - Registering on server http://tcserver.domain.local, AgentDetails{Name='tcagent1.et.local', AgentId=10, BuildId=null, AgentAddress='127.0.0.1', AlternativeAddresses=[10.25.2.130], Port=9090, Version='17132', PluginsVersion='NA', AvailableRunners=[simpleRunner], AvailableVcs=[], AuthorizationToken=...snip...'}

In the server logs:

[2011-02-27 10:46:37,358]   INFO -   jetbrains.buildServer.SERVER - Agent tcagent1.domain.local has been registered with id 10, not running a build
[2011-02-27 10:46:52,104]   INFO -   jetbrains.buildServer.SERVER - Agent tcagent1.domain.local {id=10, host=127.0.0.1:9090}@4f98f2 has been unregistered. Reason: Cannot access agent


The agent is able to connect to the server just fine and I can authorize the agent on the server.  The problem is that the server thinks the address of the agent is 127.0.0.1, so it is never able to talk to it.  In the UI it is in the disconnected window:

  • Agent name: tcagent1.domain.local
  • Hostname/IP: 127.0.0.1
  • Port: 9090


I have tried manually removing the agent a numer of times and toggling a bunch of configuration settings, but without any luck.  The server continues to think the agent is on localhost.  Thanks.
5 comments
Comment actions Permalink

Please check if you have reverse proxy on the server machine. This proxy may not set real agent IP to HTTP requiests that are sent to server.

Try to specify ownAddress and ownPort in buildAgent.properties file to disable auto-detection.

TeamCity requires two-way connection from agent to server. Please check you do not have firewalled port 9090 on agent machine.

0
Comment actions Permalink

Eugene,

1) No reverse proxy.
2) I am setting the ownAddress and ownPort in the buildAgent.properties file
3) I can telnet to port 9090 on the build agent from the build server

Any other thoughts? I put the agent log4j debug mode and see this in the RPC call:

  <configParameters>
    <param name="teamcity.agent.home.dir" value="/usr/share/TeamCity" />
    <param name="teamcity.agent.jvm.version" value="1.6.0_17" />
    <param name="teamcity.agent.launcher.version" value="17132" />
    <param name="teamcity.agent.name" value="tcagent1.domain.local" />
    <param name="teamcity.agent.ownPort" value="9090" />
    <param name="teamcity.agent.tools.dir" value="/usr/share/TeamCity/tools" />
    <param name="teamcity.agent.work.dir" value="/usr/share/TeamCity/work" />
    <param name="teamcity.serverUrl" value="http://tcserver.domain.local" />
  </configParame]]><![CDATA[ters>


It's obviously reading my config file, but it is not picking up the ownAddress property.
0
Comment actions Permalink

Please attach debug logs for the issue.

0
Comment actions Permalink

Hi,
I've exactly the same problem with my agent installed on Mac OS X. Do you gave any suggestions, how can I resolve this problem?

Regards,
Grzegorz

0
Comment actions Permalink

Hello,

Sorry for delay in answering.

TeamCity build agent and server uses two-way http communication. In most scenarios, server have a wellknown DNS name that you put to buildAgent.properties file to make agent connect to server.
Things are getting complicated for server to resolve build agent IP address.

If you specify ownAddress and ownPort parameters in buildAgent.properties TeamCity server will use them to connect to agent (don't forget to check firewall settings)

Otherwise, build agent reports the fill list of it's own IP addresses, server adds IP address from registration HTTP request. For each of those addresses server tries to ping build agent.
127.0.0.1 address most likely to came from proxy, that is used between agent and server.

Note, there could be a not-easy-to-debug case when you have a build agent running locally (i.e. 127.0.0.1:9090) and another agent that is trying to connect through proxy. This could turn out server will try to ping agent on 127.0.0.1:9090. This meas server sends ping to another agent. To fix the issue you need to change ownPort settings from 9090 (default) to any other port.

Hope I shed light to the way Agent and Server communicate. Please let me know if you solve (or not) the issue

0

Please sign in to leave a comment.