Azure-pipelines-tasks: Command-line task reports false success if STDIO left open

Created on 29 May 2020  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

_Originally posted by @glucaci in https://github.com/microsoft/azure-pipelines-tasks/issues/11334#issuecomment-583333300_

I've created new issue because nobody answers on closed one.
Below is the content of the original post:

Original:

Lately we have the same problem with a .NET Core Task. I reported this also in https://github.com/microsoft/azure-pipelines-image-generation/issues/1386 because I'm not sure where this fits.

Starting: dotnet tool restore
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.164.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
/opt/hostedtoolcache/dotnet/dotnet tool restore --ignore-failed-sources --no-cache --verbosity normal

... restoring packages

Restore was successful.
The STDIO streams did not close within 10 seconds of the exit event from process '/opt/hostedtoolcache/dotnet/dotnet'. This may indicate a child process inherited the STDIO streams and has not yet exited.

and the task will remain blocked until build timeout expires.

Update:

Also with Task Version 2.169.1

Workaround:

Enable Continue on error and set Timeout on 1 min

Release question

Most helpful comment

I'm having the same issue. Before this task I also do a NuGetAuthenticate, because we are using a DevOps Artifact Repo. Before I noticed it was running for 45mins. It happens about once every 20 builds.

This is part of the pipeline, the log for the last step is below;

  # Authenticate to Azure NuGet Source
  - task: NuGetAuthenticate@0
    displayName: 'NuGet Authenticate'

  # Build & Test DotNet apps
  - task: DotNetCoreCLI@2
    displayName: 'Restore DotNet Packages'
    inputs:
      command: 'restore'
      feedsToUse: 'config'
      nugetConfigPath: 'nuget.config'
      verbosityRestore: 'normal'

  - task: DotNetCoreCLI@2
    displayName: 'Restore DotNet Tools'
    inputs:
      command: 'custom'
      custom: 'tool'
      arguments: 'restore --verbosity normal'

As suggested by others we also have the following variables in our yml; reference https://developercommunity.visualstudio.com/content/problem/899022/dotnetcorecli-5.html If I omit this our "dotnet tool restore" fails even more often.

  - name: 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS'
    value: 30
  - name: 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS'
    value: 30
2021-01-19T13:56:50.5484644Z ##[section]Starting: Restore DotNet Tools
2021-01-19T13:56:50.5742532Z ==============================================================================
2021-01-19T13:56:50.5742850Z Task         : .NET Core
2021-01-19T13:56:50.5743126Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2021-01-19T13:56:50.5743408Z Version      : 2.179.2
2021-01-19T13:56:50.5743595Z Author       : Microsoft Corporation
2021-01-19T13:56:50.5743876Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2021-01-19T13:56:50.5744215Z ==============================================================================
2021-01-19T13:56:51.5741331Z [command]C:\windows\system32\chcp.com 65001
2021-01-19T13:56:51.5915522Z Active code page: 65001
2021-01-19T13:56:51.6178914Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
2021-01-19T13:56:51.6211035Z [command]"C:\Program Files\dotnet\dotnet.exe" tool restore --verbosity normal
2021-01-19T13:56:53.3117884Z Build started 1/19/2021 1:56:53 PM.
2021-01-19T13:56:53.3301669Z Build started 1/19/2021 1:56:53 PM.
2021-01-19T13:56:53.9619862Z      1>Project "C:\Users\VssAdministrator\AppData\Local\Temp\yb2xbuyx.doe\restore.csproj" on node 1 (Restore target(s)).
2021-01-19T13:56:53.9620852Z      1>_GetAllRestoreProjectPathItems:
2021-01-19T13:56:53.9621572Z          Determining projects to restore...
2021-01-19T13:56:53.9853258Z      1>Project "C:\Users\VssAdministrator\AppData\Local\Temp\h5bsbxpr.gzp\restore.csproj" on node 1 (Restore target(s)).
2021-01-19T13:56:53.9855129Z      1>_GetAllRestoreProjectPathItems:
2021-01-19T13:56:53.9856100Z          Determining projects to restore...
2021-01-19T13:56:54.3239663Z        Restore:
2021-01-19T13:56:54.3240773Z          Restoring packages .....

<snipped>

2021-01-19T13:57:01.6979291Z Build succeeded.
2021-01-19T13:57:01.7001260Z     0 Warning(s)
2021-01-19T13:57:01.7006055Z     0 Error(s)
2021-01-19T13:57:01.7006635Z 
2021-01-19T13:57:01.7007167Z Time Elapsed 00:00:08.37
2021-01-19T13:57:01.8580229Z Tool 'gitversion.tool' (version '5.5.1') was restored. Available commands: dotnet-gitversion
2021-01-19T13:57:01.8581114Z Tool 'dotnet-reportgenerator-globaltool' (version '4.8.4') was restored. Available commands: reportgenerator
2021-01-19T13:57:01.8582664Z 
2021-01-19T13:57:01.8582882Z Restore was successful.
2021-01-19T13:57:11.8858947Z The STDIO streams did not close within 10 seconds of the exit event from process 'C:\Program Files\dotnet\dotnet.exe'. This may indicate a child process inherited the STDIO streams and has not yet exited.
2021-01-19T13:57:11.8885895Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting

All 4 comments

Hi @glucaci, can you share the full debug logs where you have faced this issue?
Also, how can I repro this for investigation?

There is nothing more to add from the logs, it's running dotnet tool restore successfully and then it blocks and you can see the message The STDIO streams did not close....

I don't know how you can reproduce it, because also on our pipelines it happens sporadic and i assume it's a race condition somehow.

I'm having the same issue. Before this task I also do a NuGetAuthenticate, because we are using a DevOps Artifact Repo. Before I noticed it was running for 45mins. It happens about once every 20 builds.

This is part of the pipeline, the log for the last step is below;

  # Authenticate to Azure NuGet Source
  - task: NuGetAuthenticate@0
    displayName: 'NuGet Authenticate'

  # Build & Test DotNet apps
  - task: DotNetCoreCLI@2
    displayName: 'Restore DotNet Packages'
    inputs:
      command: 'restore'
      feedsToUse: 'config'
      nugetConfigPath: 'nuget.config'
      verbosityRestore: 'normal'

  - task: DotNetCoreCLI@2
    displayName: 'Restore DotNet Tools'
    inputs:
      command: 'custom'
      custom: 'tool'
      arguments: 'restore --verbosity normal'

As suggested by others we also have the following variables in our yml; reference https://developercommunity.visualstudio.com/content/problem/899022/dotnetcorecli-5.html If I omit this our "dotnet tool restore" fails even more often.

  - name: 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS'
    value: 30
  - name: 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS'
    value: 30
2021-01-19T13:56:50.5484644Z ##[section]Starting: Restore DotNet Tools
2021-01-19T13:56:50.5742532Z ==============================================================================
2021-01-19T13:56:50.5742850Z Task         : .NET Core
2021-01-19T13:56:50.5743126Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2021-01-19T13:56:50.5743408Z Version      : 2.179.2
2021-01-19T13:56:50.5743595Z Author       : Microsoft Corporation
2021-01-19T13:56:50.5743876Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2021-01-19T13:56:50.5744215Z ==============================================================================
2021-01-19T13:56:51.5741331Z [command]C:\windows\system32\chcp.com 65001
2021-01-19T13:56:51.5915522Z Active code page: 65001
2021-01-19T13:56:51.6178914Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
2021-01-19T13:56:51.6211035Z [command]"C:\Program Files\dotnet\dotnet.exe" tool restore --verbosity normal
2021-01-19T13:56:53.3117884Z Build started 1/19/2021 1:56:53 PM.
2021-01-19T13:56:53.3301669Z Build started 1/19/2021 1:56:53 PM.
2021-01-19T13:56:53.9619862Z      1>Project "C:\Users\VssAdministrator\AppData\Local\Temp\yb2xbuyx.doe\restore.csproj" on node 1 (Restore target(s)).
2021-01-19T13:56:53.9620852Z      1>_GetAllRestoreProjectPathItems:
2021-01-19T13:56:53.9621572Z          Determining projects to restore...
2021-01-19T13:56:53.9853258Z      1>Project "C:\Users\VssAdministrator\AppData\Local\Temp\h5bsbxpr.gzp\restore.csproj" on node 1 (Restore target(s)).
2021-01-19T13:56:53.9855129Z      1>_GetAllRestoreProjectPathItems:
2021-01-19T13:56:53.9856100Z          Determining projects to restore...
2021-01-19T13:56:54.3239663Z        Restore:
2021-01-19T13:56:54.3240773Z          Restoring packages .....

<snipped>

2021-01-19T13:57:01.6979291Z Build succeeded.
2021-01-19T13:57:01.7001260Z     0 Warning(s)
2021-01-19T13:57:01.7006055Z     0 Error(s)
2021-01-19T13:57:01.7006635Z 
2021-01-19T13:57:01.7007167Z Time Elapsed 00:00:08.37
2021-01-19T13:57:01.8580229Z Tool 'gitversion.tool' (version '5.5.1') was restored. Available commands: dotnet-gitversion
2021-01-19T13:57:01.8581114Z Tool 'dotnet-reportgenerator-globaltool' (version '4.8.4') was restored. Available commands: reportgenerator
2021-01-19T13:57:01.8582664Z 
2021-01-19T13:57:01.8582882Z Restore was successful.
2021-01-19T13:57:11.8858947Z The STDIO streams did not close within 10 seconds of the exit event from process 'C:\Program Files\dotnet\dotnet.exe'. This may indicate a child process inherited the STDIO streams and has not yet exited.
2021-01-19T13:57:11.8885895Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting

We are getting this error too on dotnet test command. But it's occurring intermittently.

Was this page helpful?
0 / 5 - 0 ratings