Azure自托管代理:运行多于1个构建代理时,该代理的会话已存在 [英] Azure Self Hosted agent : A session for this agent already exists , when running more then 1 build agent

查看:82
本文介绍了Azure自托管代理:运行多于1个构建代理时,该代理的会话已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了1个名为"ios_dockeragent"的代理,在代理程序池配置中:

I have defined 1 agent called "ios_dockeragent" in agent pools configuration :

设置/代理池/默认

Settings/Agent pools/Default

在我的Azure DevOps组织中,我购买了4个并行作业和3个并行托管作业,因此我没有并行作业问题.

In my Azure DevOps organization, I bought 4 Parallel jobs and 3 Parallel hosted jobs so I do not have a parallel jobs problem.

我从每个构建服务器启动这样的自托管服务器,其中"ios_dockeragent"是在devops中定义的:

From each build server I start the self hosted server like this where "ios_dockeragent" is defined in devops:

docker run -d --rm -t --name=ios_docker_64 -e AZP_WORK=/temp/working_dir -v =/temp/working_dir:/azp -e AZP_URL=https://dev.azure.com/xx -e AZP_TOKEN=nhxxxxxxxxxxmxhu76mlua -e AZP_AGENT_NAME=ios_dockeragent

当我在2台不同的服务器中并行运行2个作业时,我从代理日志中收到此错误:

When I run 2 jobs in Parallel in 2 different servers I'm getting this error from the agent log :

   X-VSS-E2EID: 2e6e97b5-f604-4b50-85ad-9fdd0db544c1^M
X-Frame-Options: SAMEORIGIN^M
X-TFS-FedAuthRealm: https://tfsprodweu6.visualstudio.com/^M
X-TFS-FedAuthIssuer: https://dev.azure.com/xxxx/^M
X-VSS-AuthorizationEndpoint: https://vssps.dev.azure.com/xxxx/^M
X-VSS-ResourceTenant: 789cbce2-e568-40be-96e3-81dddf6281f8^M
X-VSS-S2STargetService: 00000002-0000-8888-8000-000000000000/visualstudio.com^M
X-TFS-FedAuthRedirect: https://spsprodweu2.vssps.visualstudio.com/_signin?realm=dev.azure.com&reply_to=https%3A%2F%2Fdev.azure.com%2Fxxxx%2F_apis%2Fdistributedtask%2Fpools%2F1%2Fsessions&redirect=1&hid=78104741-e137-429a-b184-f357f35f83cb&context=eyJodCI6MiwiaGlkIjoiY2M2ODE0M2UtNm90#ctx=eyJTaWduSW5Db29raWVEb21haW5zIjpbImh0dHBzOi8vbG9naW4ubWljcm9zb2Z0b25saW5lLmNvbSIsImh0dHBzOi^M
Request-Context: appId=cid-v1:75f7e064-d741-4620-89f0-b5624ba3fe6d^M
Access-Control-Expose-Headers: Request-Context^M
X-Content-Type-Options: nosniff^M
X-MSEdge-Ref: Ref A: 3FE913B29BEF4D0194FD70F345C6AAE6 Ref B: ASHEDGE1414 Ref C: 2020-10-12T13:28:49Z^M
Date: Mon, 12 Oct 2020 13:28:49 GMT^M

[2020-10-12 13:28:49Z INFO RSAFileKeyManager] Loading RSA key parameters from file /azp/agent/.credentials_rsaparams
[2020-10-12 13:28:49Z INFO RSAFileKeyManager] Loading RSA key parameters from file /azp/agent/.credentials_rsaparams
[2020-10-12 13:28:50Z INFO VisualStudioServices] AAD Correlation ID for this token request: Unknown
[2020-10-12 13:28:50Z ERR  VisualStudioServices] POST request to https://dev.azure.com/xxxx/_apis/distributedtask/pools/1/sessions failed. HTTP Status: Conflict, AFD Ref: Ref A: BBBA7D16EF4349E283B21690EB631FDA Ref B: ASHEDGE1414 Ref C: 2020-10-12T13:28:50Z
[2020-10-12 13:28:50Z ERR  MessageListener] Catch exception during create session.
[2020-10-12 13:28:50Z ERR  MessageListener] Microsoft.TeamFoundation.DistributedTask.WebApi.TaskAgentSessionConflictException: The task agent ios_dockeragent already has an active session for owner b192db24b4c0.
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Listener.MessageListener.CreateSessionAsync(CancellationToken token)
[2020-10-12 13:28:50Z INFO MessageListener] The session for this agent already exists.
[2020-10-12 13:28:50Z ERR  Terminal] WRITE ERROR: A session for this agent already exists.
[2020-10-12 13:28:50Z INFO MessageListener] The session conflict exception haven't reached retry limit.
[2020-10-12 13:28:50Z ERR  Terminal] WRITE ERROR: 2020-10-12 13:28:50Z: Agent connect error: The task agent ios_dockeragent already has an active session for owner b192xx4b4c0.. Retrying until reconnected.
[2020-10-12 13:28:50Z INFO MessageListener] Sleeping for 30 seconds before retrying.
[2020-10-12 13:29:20Z INFO MessageListener] Attempt to create session.
[2020-10-12 13:29:20Z INFO MessageListener] Connecting to the Agent Server...
[2020-10-12 13:29:20Z INFO AgentServer] Establish connection with 60 seconds timeout.
[2020-10-12 13:29:20Z INFO VisualStudioServices] Starting operation Location.GetConnectionData
[2020-10-12 13:29:20Z INFO AgentServer] Establish connection with 60 seconds timeout.
[2020-10-12 13:29:20Z INFO VisualStudioServices] Starting operation Location.GetConnectionData
[2020-10-12 13:29:20Z INFO AgentServer] Establish connection with 60 seconds timeout.
[2020-10-12 13:29:20Z INFO VisualStudioServices] Starting operation Location.GetConnectionData
[2020-10-12 13:29:20Z INFO VisualStudioServices] Finished operation Location.GetConnectionData
[2020-10-12 13:29:20Z INFO VisualStudioServices] Finished operation Location.GetConnectionData
[2020-10-12 13:29:20Z INFO VisualStudioServices] Finished operation Location.GetConnectionData
[2020-10-12 13:29:20Z INFO MessageListener] VssConnection created
[2020-10-12 13:29:20Z ERR  VisualStudioServices] POST request to https://dev.azure.com/xxxx/_apis/distributedtask/pools/1/sessions failed. HTTP Status: Conflict, AFD Ref: Ref A: 00584079848E4626B042E394EC5F89B7 Ref B: BL2EDGE0921 Ref C: 2020-10-12T13:29:20Z
[2020-10-12 13:29:20Z ERR  MessageListener] Catch exception during create session.
[2020-10-12 13:29:20Z ERR  MessageListener] Microsoft.TeamFoundation.DistributedTask.WebApi.TaskAgentSessionConflictException: The task agent ios_dockeragent already has an active session for owner b192db24b4c0.
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Listener.MessageListener.CreateSessionAsync(CancellationToken token)
[2020-10-12 13:29:20Z INFO MessageListener] The session for this agent already exists.
[2020-10-12 13:29:20Z ERR  Terminal] WRITE ERROR: A session for this agent already exists.
[2020-10-12 13:29:20Z INFO MessageListener] The session conflict exception haven't reached retry limit.
[2020-10-12 13:29:20Z INFO MessageListener] Sleeping for 30 seconds before retrying.
[2020-10-12 13:29:36Z INFO Terminal] WRITE LINE: Exiting...
[2020-10-12 13:29:36Z INFO ConfigurationStore] IsServiceConfigured()
[2020-10-12 13:29:36Z INFO ConfigurationStore] IsServiceConfigured: False
[2020-10-12 13:29:36Z INFO HostContext] Agent will be shutdown for UserCancelled
[2020-10-12 13:29:36Z INFO AgentProcess] Agent execution been cancelled.
                                                                                         
                                                                                             

我仅配置了1个在这里看到的代理:

I configured only 1 agent which I see here :

要配置多个自托管代理,我需要配置什么?

What do I need to configure to run more than 1 self-hosted agent?

推荐答案

代理商需要一个唯一的名称.您正在尝试运行多个具有相同名称的代理:

Agents need a unique name. You're trying to run multiple agents with the same name:

AZP_AGENT_NAME = ios_dockeragent .

如果您要运行多个代理,请为它们提供一个唯一的名称.

If you want to run multiple agents, provide a unique name for them.

这篇关于Azure自托管代理:运行多于1个构建代理时,该代理的会话已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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