该代理程序的会话已存在 [英] The session for this agent already exists

查看:142
本文介绍了该代理程序的会话已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TFS执行每晚构建,其中包括使用 TFS测试代理。我正在运行最新版本的TFS /测试代理(2015-更新3),目前没有任何其他版本在运行。通常,(可能是一半时间)在运行夜间作业时,步骤 Visual Studio测试代理部署失败并显示以下错误:

I am using TFS to execute a nightly build that includes several steps that use the TFS Test Agent. I am running the latest version of TFS/Test Agent(2015 - Update 3) and there are no other builds being run at this time. Often(maybe half the time), when the nightly job is run the step "Visual Studio Test Agent Deployment" fails with the following error:


该工作已被放弃,因为代理Agent-XXX没有续签
锁。确保代理正在运行,没有在睡眠,并且没有丢失与服务的
通信。

The job has been abandoned because agent Agent-XXX did not renew the lock. Ensure agent is running, not sleeping, and has not lost communication with the service.

这是由于错误在测试代​​理的日志文件(位于_diag下)中找到:

This is due to the error found in the Test Agent's log file(under _diag):


该代理的会话已经存在。睡眠30秒
,然后再次尝试。

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

Microsoft.TeamFoundation.DistributedTask.WebApi.TaskAgentSessionConflictException:
任务代理Agent-XXX已经具有所有者XXX的活动会话。

Microsoft.TeamFoundation.DistributedTask.WebApi.TaskAgentSessionConflictException: The task agent Agent-XXX already has an active session for owner XXX.

直接引用此问题此处,并间接讨论了这里

This issue is directly referenced here, and indirectly talked about here.

我发现此问题的解决方案是重新启动服务器测试代理正在运行,这将清除所有无效会话,并且在服务器启动后,测试运行正常。我认为这实际上是在之前提到的帖子。重置配置的结果是重新启动了服务。

The solution I've found to this issue is to restart the server that the test agent is running on, this clears any dead sessions, and after the server starts back up, the tests run just fine. I think this is effectively what is being done in the previously mentioned post. The result of resetting the configs is that the service is restarted.

尽管在链接的文章中作为解决方案出现,但这只是暂时的。即使在服务器重新启动并且构建成功运行之后,第二天该问题就会再次出现,需要手动干预才能运行构建。

While being presented as a solution in the linked article, it is only temporary. Even after the server has been restarted and the build runs successfully, the next day the issue will again reappear necessitating manual intervention to get the build to run.

我可以安排任务以重置服务,或者甚至在每晚构建运行之前直接重新启动服务器,但这让我感到很困惑,而不是解决问题。有人曾经经历过这个问题吗?如果是这样,有什么办法可以防止它首先发生?

I could schedule a task to reset the service or even restart the server directly before the nightly build is run, but it strikes me as a bandage rather than a fix. Has anyone experienced this issue before, and if so is there any way to prevent it from occurring in the first place?

我只是建立了一个运行我的主要测试之前5分钟运行的构建,该测试运行一个 Bat脚本重新启动托管测试代理的所有服务器。这是一种解决方法,但似乎可以解决该问题。希望有一天,有人可以提出一个比这个更好的解决方案,但是现在,这就是我必须在TFS中运行自动化测试的方式。

I simply set up a build that runs 5 minutes before my main tests that runs a Bat script to restart all my servers hosting my test agents. This is a workaround, but one that seems to resolve the issue. Hopefully someday someone can come up with a better solution than this, but for now, it's how I have to run automated testing in TFS.

我现在有三台服务器,尽管这很难确定确切的时间,但所有这三台服务器都存在相同的问题。在不造成停机的情况下扩大变通方法的难度很大。

I have three servers now, all three exhibit the same issue, though it is hard to pin down exactly when it occurs. Scaling up the workaround without creating downtime it proving to be quite challenging.

有更好的一天来了,我将TFS升级到2018,并将构建代理升级到最新版本,这个问题不再发生,我认为这是旧构建代理中的错误。对于原始版本的构建代理,我仍然没有解决方案...

A better day came, I upgraded TFS to 2018, and the build agent to the latest version, this issue no longer occurs, I think its a bug in the old build agent. I still don't have a solution for the original version of the build agent...

推荐答案

我只是重新启动服务器,然后在打开run.cmd之后,我的问题解决了。
我希望这项工作对您有用。

I just restart my Server and after that open run.cmd and my problem solved. I hope this work for you.

这篇关于该代理程序的会话已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆