-
Notifications
You must be signed in to change notification settings - Fork 1.1k
dotnet build fails on .sln with IOException #11281
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
Comments
Noticed that my Directory.Build.props file wasn't covering all the shared projects (some were one level up), but putting that in the parent's one still didn't do anything. It'd be good to get some guidance on what projects need to specify the RuntimeIdentifier and if there's harm in specifying it on shared netstandard projects. |
Could you further investigate what proceeds is locking? In the meanwhile, you could try to run |
@wli3, I'll see if I can find out what's locking it when I get some time. Any hints on how to find that out in a Linux container? Will have to do some reading... I'll also try the shutdown command when I have the time and am back looking at that branch. Cheers! |
@anthony-keller-79, is it possible this is happening to us because of the Nerdbank git versioning stuff? That would be something that's changed at about the right timeframe, right? |
@benmccallum Potentially, we could try without it for a while and see if we get the issue. It can be excluded via build props I believe. We’re not using it for our services yet |
@benmccallum It looks like you have a race condition in your solution build. Can you capture and share a binary log (please note caveats if you share the log) of your build? If you can't reproduce inside the container running the commands outside the container should be sufficient--I suspect this isn't an only-in-the-container problem. A log of the failing command even when it passes is likely to be helpful. I have a tool (https://github.com/rainersigwald/ParallelBuildDebuggingLogger) to help debug this, but it's very hard to use at the moment. To unblock yourself while debugging, can you try adding |
Hi @rainersigwald, I've had a look at your caveats on the binary log and that seems fine to me. I can't think of anything secret in our projects files/props files (@anthony-keller-79, chime in if you have concerns), and have checked my ENV vars and there's nothing in there that's secret. I think it'd still be prudent if I could provide access to a select number of people though rather than just uploading it in here. What's the easiest way to do that? Upload it into OneDrive and you give me some email address to provide access to? |
I'm trying to repro with:
We definitely get it on 2.2, but I'm trying to repro on 3.1 because I'd like to push ahead with that branch. I was able to repro from cmdline outside of docker first go, but not since then. I have a feeling it might've been because I'd just closed VS which was has started trying to restore dependencies after I wiped all my obj and bin folders with a script. Reasons that make me doubt that though are:
So like you mentioned I'm still leaning towards race condition. I'm also leaning towards it being caused by Nerdbank.GitVersioning which we added fairly recently and would be the only thing that would explain why we started getting this but haven't for a very long time. I'll try a few more times, and hopefully will get lucky, else like you mentioned I'll just post even without. Swing me any Microsoft account email/s that should get access and I'll put them up in OneDrive. Cheers! |
FYI, @wli3's suggestion to shutdown the build server appears to have not worked. Just saw this on TeamCity (on our current dotnetcore 2.2 branch). Again the culprit is AutoGuru.Shared.Utilities.csproj. Interesting. I'll definitely try the cpu max count switch if it keeps causing me issues.
Second run worked. Makes you wonder if there's something in the preceding step holding on to a file, like the |
I had the same issue on ubuntu. I have installed donet sdk 3.1.401. I tried a lot of things like doing a restore separately and calling the Then I tried the suggestion of @rainersigwald and set I looked at my project structure and there are 7 projects in the solution all referencing other projects in a tree like manner. But there were additional references like this.
I updated the references in such a way that trainsient references are not stated in the csproj file.
And this fixed the issue. Though I would have thought that the build command would handle that. Also no idea what would happen in the following scenario
Here project D is references by 2 independant projects. This will most likely give the same error as above. |
reason: single threading should resolve the race condition resulting in the following error: ``` /usr/share/dotnet/sdk/8.0.101/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(284,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/home/runner/work/NuGettier/NuGettier/NuGettier.Core/NuGettier.Core.csproj] ``` caveats: single process build notes: recommended by @rainersigwald on this 4 year old and still open issue from the .NET SDK repo: dotnet/sdk#11281
Uh oh!
There was an error while loading. Please reload this page.
Recently, and all of a sudden, we're consistently running into a race condition in our builds. Initially I believed this was caused by the fact we build passing the .sln file and were also passing a runtime identifier (rid), but even without that the problem still occurs quite regularly.
I've deleted my comments off #863 as it's no longer an issue with just specifying the rid, something else is going on. I've re-iterated them in here.
Scenario
A docker container build. I'm specifically building a base image used by all our individual microservice images to speed things up. As such, restoring and building by pointing at the .sln file makes most sense. (It's not an exact science, but... that's Docker builds...)
My builder Dockerfile is doing:
My services Dockerfile is doing this:
My docker-compose.yml is essentially specifying that each service builds itself based on the common microservices-builder image:
Expected
Build succeeds.
Actual
Build fails due to a IOException (used by another process) on a shared library deps.json file.
The specific step is the
RUN dotnet build ...
in the builder Dockerfile.What I've tried
--disable-parallel
todotnet build
.Even though the Dockerfile for my services is doing a specific
dotnet test
and adotnet publish
in the specific project's directory, the intent is really that these don't need to do much (--no-restore is passed, etc.) as the image it's based on from the first Dockerfile has done all the hard work and cached everything along the way. This is essential in docker builds to speed up things.Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: