microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.42k stars 2.59k forks source link

DotNetCoreCLI@2's `dotnet test` hangs indefinitely when a child process inherited the STDIO streams and has not yet exited #17548

Open ChristoWolf opened 1 year ago

ChristoWolf commented 1 year ago

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: DotNetCoreCLI@2

Environment

Issue Description

Instead of showing the current execution time as usual, executing the test command via the DotNetCoreCLI@2 task shows 100% while hanging indefinitely (until the configured timeout triggers), and not traces of the log can be found anywhere (there are bits and pieces of the log in the agent's _diag/pages folder, but nothing complete).

This happens when a child process of dotnet locks its IO stream(s), and dotnet test reports

The STDIO streams did not close within 10 seconds of the exit event from process 'C:\agent\_work\_tool\dotnet\dotnet.exe'. This may indicate a child process inherited the STDIO streams and has not yet exited.

Task logs

N/A

ChristoWolf commented 1 year ago

I cannot verify this currently, but this might be fixed by this agent bug fix.

BoutemineOualid commented 1 year ago

Same issue here.

sona-jain commented 11 months ago

I am hitting same issue. What circumstances make it hang?

NorbertNemec commented 10 months ago

I'm experiencing a very similar issue with a different task (in my case https://www.unitydevops.com/) - the problem here is that Unity.exe - a complex program outside our control - leaves some child processed alive when it exists cleanly. The executable cleanly ends with Exit Code 0 but then Azure Pipelines still waits indefinitely until it times out and considers the task failed.

Unfortunately, Azure Pipelines offers not info about which child process is still running and offers no means to kill the child processes. Following some discussion on various forums, I would even have assumed that it should kill child processes by default and provide some info (error?) about that.

maranmaran commented 9 months ago

Finding same issues with Specflow and chrome driver staying active.

ChristoWolf commented 5 months ago

Hi @rvairavelu!

Are there any news regarding this issue?

GabrielHSFerreira commented 2 months ago

Hi guys.

Having same problem here when running multiple test projects. Any workarounds available?

GabrielHSFerreira commented 2 months ago

Is it the same problem reported on https://github.com/dotnet/sdk/issues/27106 and https://github.com/dotnet/sdk/issues/9452?