microsoft / vso-agent

Visual Studio Team Services and TFS agent for Mac OSX and Linux
MIT License
131 stars 57 forks source link

The session for this agent already exists. Sleeping for 30 seconds before next retry. #202

Closed MrMac30 closed 8 years ago

MrMac30 commented 8 years ago

All of my agents on my build server suddenly stop picking up builds. I'm seeing the message "The session for this agent already exists. Sleeping for 30 seconds before next retry." After it retries for a while it shuts down the service. Any idea how I can fix this.

I believe I'm on agent version 1.89.1

ericsciple commented 8 years ago

Assuming you are talking about the Windows agent. If the agent process abruptly terminates, the session may be left open and will eventually expire on the server after 5 minutes.

If you look on the agent admin UI, does the agent still show as connected? That's the only way that comes to mind offhand how you might run into this issue.

ericsciple commented 8 years ago

Somehow I forgot to add a crucial sentence: Did you xcopy the agent folder and try to run the second one while the first is running? That's the only way that comes to mind offhand how you might run into this issue. If you don't run through configure for the second, then it would hit session conflict b/c it is trying to connect using the same agent ID (in the settings.json).

bryanmacfarlane commented 8 years ago

correct. you must download and configure discrete copies. Xcopying an existing agent copies the config and the message is by design - two instances of an agent by id can't listen to the same queue.

Further, this is the repo for the xplat agent. Good news is we're combining into a single coreCLR agent and that will exist in this repo as well.

MrMac30 commented 8 years ago

I move my question somewhere else. I did not copy the directory with the config. I put the agent.zip file on the server, and unzip it multiple times, running the configuration for each agent. The agents actually worked fine for about 2 weeks, then they all went down, and I still can't get them to come back up, and it has been three days.

MrMac30 commented 8 years ago

The admin ui does still show the agents as connected even though the window service is not running. I check the AgentIds and they are all unique.

ericsciple commented 8 years ago

AFAIK the admin UI is always accurate. If they are showing as online, then my guess would be that they are still running somewhere. Ctrl+F5 to hard-refresh the page to verify not a browser cache issue.

Another thing you can check is the computer name in the capabilities section for the online agent. That will at least narrow it down to verify you're looking for the agents on the correct machine. Further more, after you configure an interactive agent, the configuration will (default setting) drop you into an interactive session and you have to ctrl+c to stop the agent or kill the window. Perhaps you've left the window open?

Lastly, for the Windows agent make sure you are following the configuration steps here: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/agents/windows

If that doesn't work, let me know.

bryanmacfarlane commented 8 years ago

In VSTS it will always show accurately because we did Signal - R recently so eric is correct. If it's on prem RTM or QU1 the changes might not be there and may require a refresh.