Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The process cannot access the file" error sporadically but frequently in CI builds #32300

Closed
stephentoub opened this issue Feb 14, 2020 · 11 comments · Fixed by dotnet/arcade#4858
Labels
area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner

Comments

@stephentoub
Copy link
Member

stephentoub commented Feb 14, 2020

I've been seeing CI legs failing sporadically but frequently with an error like this during the build:

  The process cannot access the file 'F:\workspace\_work\1\s\artifacts\SymStore\Debug\System.Security.Cryptography.Pkcs\netcoreapp5.0\System.Security.Cryptography.Pkcs.pdb' because it is being used by another process.
F:\workspace\_work\1\s\.packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20112.7\tools\SymStore.targets(61,5): error MSB3073: The command ""F:\workspace\_work\1\s\.packages\microsoft.diasymreader.pdb2pdb\1.1.0-beta2-19575-01\tools\Pdb2Pdb.exe" "F:\workspace\_work\1\s\artifacts\bin\System.Security.Cryptography.Pkcs\netcoreapp5.0-Windows_NT-Debug\System.Security.Cryptography.Pkcs.dll" /out "F:\workspace\_work\1\s\artifacts\SymStore\Debug\System.Security.Cryptography.Pkcs\netcoreapp5.0\System.Security.Cryptography.Pkcs.pdb" /srcsvrvar SRC_INDEX=public" exited with code 2. [F:\workspace\_work\1\s\src\libraries\System.Security.Cryptography.Pkcs\src\System.Security.Cryptography.Pkcs.csproj]
##[error].packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20112.7\tools\SymStore.targets(61,5): error MSB3073: The command ""F:\workspace\_work\1\s\.packages\microsoft.diasymreader.pdb2pdb\1.1.0-beta2-19575-01\tools\Pdb2Pdb.exe" "F:\workspace\_work\1\s\artifacts\bin\System.Security.Cryptography.Pkcs\netcoreapp5.0-Windows_NT-Debug\System.Security.Cryptography.Pkcs.dll" /out "F:\workspace\_work\1\s\artifacts\SymStore\Debug\System.Security.Cryptography.Pkcs\netcoreapp5.0\System.Security.Cryptography.Pkcs.pdb" /srcsvrvar SRC_INDEX=public" exited with code 2.

e.g. https://dev.azure.com/dnceng/public/_build/results?buildId=520739&view=logs&jobId=423ae147-26a3-5a4d-a4d3-4b3fc1dd598e&j=423ae147-26a3-5a4d-a4d3-4b3fc1dd598e&t=3d4a7aa4-0a94-53e5-e198-62555696ed38
cc: @ViktorHofer

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner labels Feb 14, 2020
@stephentoub stephentoub changed the title "File in use error" sporadically but frequently in CI builds "The process cannot access the file" error sporadically but frequently in CI builds Feb 14, 2020
@ViktorHofer
Copy link
Member

@tmat possibly a race in SymStore.targets?

@tmat
Copy link
Member

tmat commented Feb 15, 2020

The error is caused by converted PDBs for two different target frameworks being generated into the same directory.
SymStore.targets uses $(TargetFramework) in the output directory path. The value of TargetFramework when the target runs is netcoreapp5.0, not netcoreapp5.0-Windows_NT.

It seems that the property value is split on - and reassigned here:
microsoft.dotnet.build.tasks.targetframework.sdk\5.0.0-beta.20112.7\build\Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk.props

@ViktorHofer
Copy link
Member

Thanks @tmat, you are right, our TargetFramework properties aren't unique per build. @ercistj @Anipik, suggestions?

@Anipik
Copy link
Contributor

Anipik commented Feb 16, 2020

we should fix it by overriding the symbols path to include OSGroup similar to what we do for output and intermediate paths.

@ViktorHofer
Copy link
Member

In this case sure, even though we should probably avoid using OSGroup which is a custom property in dotnet/runtime, I would prefer TargetFrameworkSuffix. How would we fix other instances where we don't own the sources and can't hook into them? Can we avoid such breaks by coming up with a better pattern which guarantees unique TargetFramework properties in the different inner-builds?

@Anipik
Copy link
Contributor

Anipik commented Feb 16, 2020

Yes i should have been more clear, we use TargetFrameworkSuffix for paths. We should use that only.

Can we avoid such breaks by coming up with a better pattern which guarantees unique TargetFramework properties in the different inner-builds?

Actually, That was our first experiment. Later on this project we shifted to remove the TargetFrameworkSuffix from TargetFramework bcoz we hit a significant block. I will try to dig up the reason. @ericstj do u remember wht caused us to remove the TargetFrameworkSuffix during the build ?

How would we fix other instances where we don't own the sources and can't hook into them?

we could move the output path calculation stuff to sdk rather in the runtime repo and then anybody using the sdk wouldnt require to update the paths.

@ViktorHofer
Copy link
Member

we could move the output path calculation stuff to sdk rather in the runtime repo and then anybody using the sdk wouldnt require to update the paths.

That wouldn't have helped in this situation as the path is calculated in an external component without using pre-defined variables like (Base)OutputPath or (Base)IntermediateOutputPath: https://github.com/dotnet/arcade/blob/2086e534f12e6116889ee480646ef54c1f781887/src/Microsoft.DotNet.Arcade.Sdk/tools/SymStore.targets#L28

Actually, That was our first experiment.

+1. Yes, please dig up the reason for the change in direction.

@tmat
Copy link
Member

tmat commented Feb 16, 2020

Also, how does this gonna work with the new .NET SDK feature that also adds platform specification to the TFM?

@ViktorHofer
Copy link
Member

@ViktorHofer
Copy link
Member

Also, how does this gonna work with the new .NET SDK feature that also adds platform specification to the TFM?

That's still tbd but using a different separator should be fine as well. In the meantime I propose to fix this by (conditionally) adding the TargetFrameworkSuffix property to SymStore.targets.

ViktorHofer added a commit to dotnet/arcade that referenced this issue Feb 17, 2020
Fixes dotnet/runtime#32300

This fixes the frequent failures where multiple inner builds try to write to the same location in combination with SymStore.targets. As discussed in the linked issue, we should investigate if we can change the TargetFramework.Sdk to not depend on such hacks.
@tmat
Copy link
Member

tmat commented Feb 17, 2020

@ViktorHofer Sounds good, as long as that's just a temporary workaround. As you pointed out Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk.props breaks invariant that holds in standard SDK build.

ViktorHofer added a commit to dotnet/arcade that referenced this issue Feb 17, 2020
* Support TargetFramework.Sdk in SymStore.targets

Fixes dotnet/runtime#32300

This fixes the frequent failures where multiple inner builds try to write to the same location in combination with SymStore.targets. As discussed in the linked issue, we should investigate if we can change the TargetFramework.Sdk to not depend on such hacks.
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants