Race condition building moduleLibrary.csproj
src\JIT\Methodical\flowgraph\bug619534\moduleHandleCache.csproj has a project reference to src\JIT\Methodical\flowgraph\bug619534\moduleLibrary.csproj
This would cause moduleLibrary to build when moduleHandleCache does. However, the system will probably also recognize moduleLibrary.csproj as a test itself (it looks for all csproj’s under test\src) so it coujld end up trying to build them at the same time.
I believe this is the cause of some "cannot access blah blah" errors in CI.
/cc @CarolEidt @LLITCHEV @dotnet/jit-contrib
The same pattern exists in many places - dotnet/coreclr#2974 just failed in tests\src\GC\API\GCSettings\.
msbuild should take care of scheduling these project-to-project references correctly.
I suspect that this problem might have been introduced by the recent build tools update for tests.
@rahku Could you please take a look?
No I believe this is antimalware/antivirus software interfering with build. Can you add your repo root folder to defender exclusion list and see if this persists.
@rahku There isn't windows defender/av running on any of these boxes. This is also the only instance I've ever seen of this, and I don't think it's a coincidence that this is a project with a ProjectReference.
Also MSBuild will build the project twice if the input project properties end up being different, even subtly.
Found another instance:
C:\enlistments\coreclr\tests\src>findstr -sip GCUtil_HeapExpansion *
GC\Features\HeapExpansion\Finalizer.csproj:
C:\enlistments\coreclr\tests\src>
C:\enlistments\coreclr\tests\src>dir /S GCUtil_HeapExpansion Volume in drive C has no label. Volume Serial Number is 22E3-9335
Directory of C:\enlistments\coreclr\tests\src\GC\Features\HeapExpansion
10/22/2015 07:27 AM 2,259 GCUtil_HeapExpansion.csproj 1 File(s) 2,259 bytes
Total Files Listed:
1 File(s) 2,259 bytes
0 Dir(s) 56,747,134,976 bytes free
Looking at this.
@rahku I believe this is a similar issue as what's causing https://github.com/dotnet/coreclr/issues/2713. I switched the tests in question to priority 2 so that the issue won't be seen, but it still exists. Do you think this is the same/similar issue with a similar solution? I just confirmed that the race condition still exists by building priority 2 tests locally, here's a dump of the failures:
CSC : error CS2012: Cannot open 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threa ding\interlocked\compareexchange\CompareExchangeTClass\CompareExchangeTClass.exe' for writing -- 'The process cannot ac cess the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\interlocked\c ompareexchange\CompareExchangeTClass\CompareExchangeTClass.exe' because it is being used by another process.' [C:\Users \wigodbe\coreclr\tests\src\baseservices\threading\interlocked\compareexchange\CompareExchangeTClass.csproj] CSC : error CS2012: Cannot open 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threa ding\paramthreadstart\ThreadStartDelegate\ThreadStartDelegate.exe' for writing -- 'The process cannot access the file ' C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStart Delegate\ThreadStartDelegate.exe' because it is being used by another process.' [C:\Users\wigodbe\coreclr\tests\src\bas eservices\threading\paramthreadstart\ThreadStartDelegate.csproj] C:\Users\wigodbe\coreclr\Tools\sign.targets(41,5): error : C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x 64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartGenerics\ThreadStartGenerics.exe: I/O error reading or writing PE file: The process cannot access the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Ma naged\baseservices\threading\paramthreadstart\ThreadStartGenerics\ThreadStartGenerics.exe' because it is being used by another process. [C:\Users\wigodbe\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartGenerics.csproj ] C:\Users\wigodbe\coreclr\Tools\sign.targets(41,5): error : C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x 64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartLong\ThreadStartLong.exe: I/O error reading or writ ing PE file: The process cannot access the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\ba seservices\threading\paramthreadstart\ThreadStartLong\ThreadStartLong.exe' because it is being used by another process. [C:\Users\wigodbe\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartLong.csproj] C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4654,5): error MSB3491: Could not write lines to file "C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\par amthreadstart\ThreadStartLong\ThreadStartLong.csproj.FileListAbsolute.txt". The process cannot access the file 'C:\User s\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartLong\Th readStartLong.csproj.FileListAbsolute.txt' because it is being used by another process. [C:\Users\wigodbe\coreclr\tests \src\baseservices\threading\paramthreadstart\ThreadStartLong.csproj] C:\Users\wigodbe\coreclr\Tools\sign.targets(41,5): error : C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x 64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartOperations\ThreadStartOperations.exe: I/O error rea ding or writing PE file: The process cannot access the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debu g\Managed\baseservices\threading\paramthreadstart\ThreadStartOperations\ThreadStartOperations.exe' because it is being used by another process. [C:\Users\wigodbe\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartOperati ons.csproj] C:\Users\wigodbe\coreclr\Tools\sign.targets(41,5): error : C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x 64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartSByte\ThreadStartSByte.exe: I/O error reading or wr iting PE file: The process cannot access the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\ baseservices\threading\paramthreadstart\ThreadStartSByte\ThreadStartSByte.exe' because it is being used by another proc ess. [C:\Users\wigodbe\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartSByte.csproj] CSC : error CS2012: Cannot open 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threa ding\paramthreadstart\ThreadStartShort\ThreadStartShort.exe' for writing -- 'The process cannot access the file 'C:\Use rs\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartShort\ ThreadStartShort.exe' because it is being used by another process.' [C:\Users\wigodbe\coreclr\tests\src\baseservices\th reading\paramthreadstart\ThreadStartShort.csproj] CSC : error CS2012: Cannot open 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threa ding\paramthreadstart\ThreadStartString\ThreadStartString.exe' for writing -- 'The process cannot access the file 'C:\U sers\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartStri ng\ThreadStartString.exe' because it is being used by another process.' [C:\Users\wigodbe\coreclr\tests\src\baseservice s\threading\paramthreadstart\ThreadStartString.csproj] CSC : error CS2012: Cannot open 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threa ding\paramthreadstart\ThreadStartUInt\ThreadStartUInt.exe' for writing -- 'The process cannot access the file 'C:\Users \wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartUInt\Thr eadStartUInt.exe' because it is being used by another process.' [C:\Users\wigodbe\coreclr\tests\src\baseservices\thread ing\paramthreadstart\ThreadStartUInt.csproj] C:\Users\wigodbe\coreclr\Tools\sign.targets(41,5): error : C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x 64.Debug\Managed\baseservices\threading\paramthreadstart\ThreadStartUShort\ThreadStartUShort.exe: I/O error reading or writing PE file: The process cannot access the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Manage d\baseservices\threading\paramthreadstart\ThreadStartUShort\ThreadStartUShort.exe' because it is being used by another process. [C:\Users\wigodbe\coreclr\tests\src\baseservices\threading\paramthreadstart\ThreadStartUShort.csproj] C:\Users\wigodbe\coreclr\Tools\sign.targets(41,5): error : C:\Users\wigodbe\coreclr\tests\..\bin\tests\obj\Windows_NT.x 64.Debug\Managed\Loader\classloader\nesting\coreclr\VSW491577\VSW491577.exe: I/O error reading or writing PE file: The process cannot access the file 'C:\Users\wigodbe\coreclr\bin\tests\obj\Windows_NT.x64.Debug\Managed\Loader\classloader\ nesting\coreclr\VSW491577\VSW491577.exe' because it is being used by another process. [C:\Users\wigodbe\coreclr\tests\s rc\Loader\classloader\nesting\coreclr\VSW491577.csproj]
In this case, a single test has multiple .csproj files, several of which (run-onlies) reference the first (build-only), as opposed to one test's .csproj file referencing another test's .csproj file.
I have seen these errors much before toolset update. So I do not think toolset update has caused this issue. In this particular issue tests were built more than once....do you see the same thing. If yes then you need to find out what build parameter difference is causing the project to be built twice.