Build race conditions in priority 2 tests
There seems to be a race condition when building "priority 2" tests. I've only seen them in two folders
tests\src\baseservices\threading\interlocked
tests\src\baseservices\threading\paramthreadstart
It may have something to do with the pattern of referencing BuildOnly projects from RunOnly projects, as those folders contain the vast majority of the examples in the tree; the only other example being
tests\src\Loader\classloader\nesting\coreclr\VSW491577*.csproj.
Below are samples of the errors I've seen:
CSC : error CS2012: Cannot open 'C:\git\coreclr\bin\tests\obj\baseservices\threading\interlocked\add\InterlockedAddInt\InterlockedAddInt.exe' for writing -- 'The process cannot access the file 'C:\git\coreclr\bin\tests\obj\baseservices\threading\interlocked\add\InterlockedAddInt\InterlockedAddInt.exe' because it is being used by another process.' [C:\git\coreclr\tests\src\baseservices\threading\interlocked\add\InterlockedAddInt.csproj]
CSC : error CS2012: Cannot open 'C:\git\coreclr\bin\tests\obj\baseservices\threading\paramthreadstart\ThreadStartByte\ThreadStartByte.exe' for writing -- 'The process cannot access the file 'C:\git\coreclr\bin\tests\obj\baseservices\threading\paramthreadstart\ThreadStartByte\ThreadStartByte.exe' because it is being used by another process.' [C:\git\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartByte.csproj]
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4411,5): error MSB3491: Could not write lines to file "C:\git\coreclr\tests\..\bin\tests\obj\baseservices\threading\paramthreadstart\ThreadStartObject\ThreadStartObject.csproj.FileListAbsolute.txt". The process cannot access the file 'C:\git\coreclr\bin\tests\obj\baseservices\threading\paramthreadstart\ThreadStartObject\ThreadStartObject.csproj.FileListAbsolute.txt' because it is being used by another process. [C:\git\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartObject.csproj]
C:\git\coreclr\tests\packages\Microsoft.DotNet.BuildTools.1.0.25-prerelease-00121\lib\sign.targets(39,5): error : C:\git\coreclr\tests\..\bin\tests\obj\baseservices\threading\paramthreadstart\ThreadStartChar\ThreadStartChar.exe: I/O error reading or writing PE file: The process cannot access the file 'C:\git\coreclr\bin\tests\obj\baseservices\threading\paramthreadstart\ThreadStartChar\ThreadStartChar.exe' because it is being used by another process. [C:\git\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartChar.csproj]
I'm looking into this with @bryanar, we had the same conclusion you did about referencing BuildOnly's from RunOnlys.
To be clear, the tests causing this failure are pri 1, not pri 2 (build priority 2 causes all priority 0, 1, and 2 tests to be built). I have a PR up to switch them to pri 2 temporarily so that all pri 1 and 0 tests can be built and run in the CI.
This is not fixed. All that was done was to remove the failures when building priority 1. They are still there when building priority 2.
CC @gkhanna79 @sergiy-k
@wtgodbe Do you have an update on this?
Not yet, I need to work with @bryanar to take a look at this.
This has been fixed by https://github.com/dotnet/coreclr/pull/3469