-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Our official build has started failing during the "Get sources" step in the Package Job leg:
https://devdiv.visualstudio.com/DevDiv/_build?definitionId=8739&_a=summary
2018-10-24T15:20:03.7394442Z ##[warning]Unable to run "git clean -ffdx" and "git reset --hard HEAD" successfully, delete source folder instead.
2018-10-24T15:20:04.6899315Z ##[error]System.AggregateException: One or more errors occurred. (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\dotnet.exe' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\hostpolicy.dll' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\clrjit.dll' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\netstandard.dll' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\clrcompression.dll' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\Microsoft.DotNet.Build.Tasks.dll' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\coreclr.dll' is denied.)) (One or more errors occurred. (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\mscorrc.debug.dll' is denied.)) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\dotnet.exe' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\hostpolicy.dll' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\clrjit.dll' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\netstandard.dll' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\clrcompression.dll' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\Microsoft.DotNet.Build.Tasks.dll' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\coreclr.dll' is denied.) (Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\shared\Microsoft.NETCore.App\2.1.3\mscorrc.debug.dll' is denied.) ---> System.UnauthorizedAccessException: Access to the path 'E:\A\_work\327\s\Tools\dotnetcli\dotnet.exe' is denied.
at System.IO.FileSystem.DeleteFile(String fullPath)
When this occurs, it appears to happen when the Windows Job runs on the same machine as the Package Job. So a process must be leaking during the Windows Job, and is holding on to dotnet.exe and friends. Thus when the Package Job executes, and tries cleaning the repo, it fails.
A possible fix here is to kill any dotnet processes after Windows Job. See https://github.com/dotnet/corefx/blob/master/buildpipeline/DotNet-CoreFx-Trusted-Windows.json#L26-L45 for an example.
Another possible fix is to call dotnet build-server shutdown at the end of our build scripts (assuming it is the build-server that is holding dotnet.exe open.