question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Command-line task reports false success if STDIO left open

See original GitHub issue

_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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:28 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Kolkycommented, Jan 19, 2021

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
2reactions
glucacicommented, Oct 6, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSB4181: The 'task' task returned false but did not log an error
In this article. This error occurs when a task returned false to signal that it didn't complete successfully, but didn't log an error....
Read more >
Tasks in Visual Studio Code
Integrate with External Tools via Tasks. Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems.
Read more >
Troubleshoot build performance with Build Analyzer
This means that those tasks outputs are most likely not being preserved between builds and those tasks always run, even when there are...
Read more >
Visual Studio compiles fine, but it still shows red lines
Are you perhaps running old code? Try a small implementation that shows something, if nothing happens you might be running old code. –...
Read more >
Command: validate | Terraform - HashiCorp Developer
Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or existing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found