coapp / coapp.powershell

ClrPlus Signing
52 stars 43 forks source link

File access errors during multithreaded builds #33

Open yodantauber opened 11 years ago

yodantauber commented 11 years ago

Sometimes when building a big solution, which contains a lot of projects consuming multiple packages (with multiple projects consuming the same package), I get an error such as this one during (usually early in) the build:

1>D:\dev\NugetCache\Boost.1.52.0-a\build\native\Boost.targets(189,5): error : NuGet Error:The process cannot access the file 'D:\dev\NugetCache\Boost.1.52.0-a\build\native\bin\x64\v110_xp\Release\boost_serialization-vc110-mt-1_52.dll' because it is being used by another process.

Most of the time, just aborting the build and trying again resolves the error. I guess it is caused by two separate builds trying to access (copy?) the same file from the same package simultaneously.

I don't know if this is a NuGet issue or a CoApp issue. Unfortunately, I also don't know yet if I can provide some minimal setting that will reproduce this bug, but I'll keep trying to isolate it.

fearthecowboy commented 11 years ago

That's a really good question.

It doesn't look like it's complaining about the destination file, but rather the source.

If this is using the new-style overlay packages, I wonder if multiple builds are trying to overlay the same file at the same time?

When you get that message what's at line 189 of the Boost.targets file?

yodantauber commented 11 years ago

Indeed, this package has been built with v2.4.199.0 so it uses the new overlay packages. This is line 189:

<NuGetPackageOverlay Package="Boost.overlay-x64_v110_xp_Release" Version="$(Needs-Boost-Version)" PackageDirectory="$(MSBuildThisFileDirectory)\..\.." SolutionDirectory="$(SolutionDir)" Condition="'$(Platform.ToLower())' == 'x64' And '$(PlatformToolset.ToLower())' == 'v110_xp' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 )" />
fearthecowboy commented 11 years ago

Yeah, that looks like two builds are trying to overlay the same package at the same time. I think I can solve this by putting a mutex on the overlay name.

yodantauber commented 11 years ago

btw, I've also seen problems with the destination paths when copying files using the MSBuild task (which say something about the failure of 10 retries).

yodantauber commented 10 years ago

Have you added a mutex yet? I'm still getting these errors with version 2.4.493.0.