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

Can't reliably build on .NET 8 on large multi proc machines #14721

Closed
shanselman opened this issue Nov 19, 2023 · 11 comments · Fixed by #14732
Closed

Can't reliably build on .NET 8 on large multi proc machines #14721

shanselman opened this issue Nov 19, 2023 · 11 comments · Fixed by #14732
Labels

Comments

@shanselman
Copy link

Describe the bug

Can't reliably build on .NET 8 on large multi proc machines. dotnet build always fails with "The process cannot access the file" on some random objs (likely a .targets file issue)

To Reproduce

Steps to reproduce the behavior:

  1. clone fresh on a 8-16-32 proc machine
  2. dotnet build
  3. observe fail
  4. now try dotnet build -m:1 and it'll work. 2 or 3 works. Anything >= 4 always fails

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

@DamianEdwards
Copy link

I reproduced this with .NET 7 too (SDK 7.0.404)

@jtkech
Copy link
Member

jtkech commented Nov 19, 2023

Which version because from recently we only target net8.0 (OC preview version).

Otherwise in our github actions we needed to build all TFMs one after each other (by specifying the TFM).

As I remember it was failing (but not always) when files are outputed concurrently.

Didn't know about the -m: switch.

Can you try with only -f net8.0 or -f net7.0 depending on your OC version.

I will try asap.

Edited: Just tried, it works but yes I only have 4 cores.

@sebastienros
Copy link
Member

@jtkech I believe we updated SourceLink to 8.0.0 in YesSql, it was 1.1.1 before. (The failing step mentions a conflict ot yessql.sourcelink file)

@sebastienros
Copy link
Member

I have the same issue with different files. 16 cores. @jtkech your machine might not be fast enough to reproduce the problem. Not specific to sourcelink though.

@sebastienros
Copy link
Member

Going back to a commit that targets 6/7/8 I can repro with dotnet build but not with individual -f 6/7/8.

Example:

CSC : error CS2012: Cannot open 'C:\code\orchardcore\src\OrchardCore.Modules\OrchardCore.Seo\obj\Debug\net8.0\OrchardCo
re.Seo.dll' for writing -- 'The process cannot access the file 'C:\code\orchardcore\src\OrchardCore.Modules\OrchardCore
.Seo\obj\Debug\net8.0\OrchardCore.Seo.dll' because it is being used by another process.' [C:\code\orchardcore\src\Orcha
rdCore.Modules\OrchardCore.Seo\OrchardCore.Seo.csproj::TargetFramework=net8.0]

@sebastienros
Copy link
Member

On main, which only targets net8.0, I did three rounds of

git clean -xdff
dotnet build
git clean -xdff
dotnet build -f net8.0

Each time the dotnet build failed and the -f net8.0 succeeded.

@sebastienros
Copy link
Member

Please try the branch sebros/minmultit to confirm that fixes the problem.

@DamianEdwards
Copy link

Please try the branch sebros/minmultit to confirm that fixes the problem.

Seems to work for me now

@Piedone
Copy link
Member

Piedone commented Nov 23, 2023

FWIW we had the similar "warning MSB3026: Could not copy DLLs" happening with CI builds running dotnet build (but not builds in Visual Studio) forever, like since .NET Core.

@Skrypt
Copy link
Contributor

Skrypt commented Nov 23, 2023

You can also repro this issue by debugging in VS and VS Code at the same time. Happens to me all the time, forgetting I'm running VS Code, then I need to stop one of the debuggers.

@sebastienros
Copy link
Member

I am investigating the problem with some engineers from the SDK. I have a reliable repro and binlog files that shows some information about the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants