Azure Pipelines突发System.ArgumentNullException问题求助及临时方案咨询
Azure Pipelines托管代理突发NullReference故障排查与解决
问题描述
Azure Pipelines托管代理(使用ubuntu-latest镜像)突发故障,此前流水线运行完全正常。故障表现为阶段等待代理分配后直接失败,取消流水线并重启动阶段仍会复现相同问题。我们采用YAML定义流水线,无法访问报错提示中指定的诊断日志文件。
报错信息
##[error]System.ArgumentNullException: Value cannot be null. (Parameter ‘input’) at System.Text.RegularExpressions.Regex.Replace(String input, String replacement) at Microsoft.VisualStudio.Services.Agent.Util.StringUtil.DeactivateVsoCommands(String input) at Microsoft.VisualStudio.Services.Agent.Worker.WorkerUtilities.DeactivateVsoCommandsFromJobMessageVariables(AgentJobRequestMessage message) at Microsoft.VisualStudio.Services.Agent.Worker.Worker.RunAsync(String pipeIn, String pipeOut) at Microsoft.VisualStudio.Services.Agent.Worker.Program.MainAsync(IHostContext context, String[] args) Error reported in diagnostic logs. Please examine the log for more details. - /home/vsts/agents/2.213.1/_diag/Worker_20221110-110312-utc.log Pool: Azure Pipelines Image: ubuntu-latest Queued: Today at 13:00 [manage parallel jobs] The agent request is already running or has already completed.
问题原因
从报错堆栈信息分析,该问题属于Azure Pipelines托管代理版本2.213.1的bug:Agent在执行StringUtil.DeactivateVsoCommands方法时,传入了null值作为输入参数,触发了ArgumentNullException。
临时解决办法
- 切换至其他版本的Ubuntu托管镜像,例如
ubuntu-20.04或ubuntu-18.04,避开存在问题的ubuntu-latest镜像(当时该镜像绑定了2.213.1版本代理) - 若业务必须使用
ubuntu-latest,可尝试在流水线YAML中调整变量配置,避免触发null值处理逻辑
官方修复更新
2022年11月14日,微软为托管代理推送了2.213.2版本补丁,该故障已被正式解决,可恢复使用原ubuntu-latest镜像的流水线配置。
内容的提问来源于stack exchange,提问作者Roman
相关产品推荐
相关产品推荐

