-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet build leaves running dotnet.exe processes after it finishes (.csproj specific) #9487
Comments
This is by design in 2.1.300. As part of our perf improvements, we introduced three persistent servers with the goal of reduce our JIT time. The servers are the razor compilation server, the vbcscompiler server and the msbuild node re-use server. If you don't want them staying around when you are done building, you can invoke If you don't want them to start to begin with, you can set different properties/environment variables to prevent them from starting. From @peterhuene:
|
They're causing spurious build failures due to holding locks. |
@livarcocc I have a whole bunch of teamcity agents that are having the same issue as @jhudsoncedaron. The processes somehow doesn't release the files under a build of a project. random json files/dll's are not released and the build fails.. If i try to rerun the same build, it fails again. If i kill the 3 .NET core host processes, i can successfully build again, once or twice then the error occurs again. Build steps are like:
It can fail randomly under each step. This happened after we upgraded our TC agents with the latest version of dotnet core: .NET Core SDK (reflecting any global.json): Runtime Environment: Host (useful for support): .NET Core SDKs installed: .NET Core runtimes installed: To install additional .NET Core runtimes or SDKs: |
Have you tried the steps that I suggested above? |
Yes, i have tried all of the above and the builds continued to fail I ended up adding I'm not sure if my issue is related to dotnet/cli#9648 |
But that's (#9648) my issue. If it weren't for the fact that this is the older number I'd say it was a duplicate. |
|
@jasondaicoder what DLLs are those |
Relates to https://github.com/dotnet/cli/issues/9458 The processes somehow doesn't release the files under a build of a project. Random json files/dll's are not released and the build fails. Signed-off-by: Pawel Panek <p.panek@samsung.com>
We are also experiencing locked files in build environments being held by the dotnet process. If the work it's performing is done, shouldn't it be releasing the files it was using? Even in the case of Razor, different builds could use different versions of the package so shouldn't there be some sort of AssemblyLoadContext to allow GC or a non-locking load behavior (load by byte-array, copy before load, etc.)? This also prevents clearing the NuGet package cache, even in idle environments. EDIT: here's an issue from TeamCity restoring packages
|
Same here, linux gitlab build server had lots of dotnet processes running |
So in the years, most of the "locks" problems have been fixed, but there are two big problems left.
|
I have dozens of these lingering processes, please revert the default behavior to not leave them hanging around |
Was keeping MO2 from shutting down properly. dotnet/sdk#9487
FYI for the next person - we're on Ubuntu 18/20.04 and we're currently stuck with an ancient version of .net (trying to get rid of it and too embarrassed to quote the version here in public) and adding the flags to our restore, build, and publish steps helped and then at the end we added shutdown mentioned as well for good measure - now our build scripts are at least being polite to each other and we can focus on fixing the issues and getting onto a new version of .net As per @livarcocc's recommendation above, we added the following two flags to each step restore, build, publish: And as per @jasondaicoder's recommendation above we added this to the end of our build: I hope this helps someone else stuck with a ratty old version of .net that is causing a headache. |
The problem is still present in NET 6.0.100. As you can see here, the command starts, but never complete. I feel this issue should be reopened ASAP, since it's blocking all our CI/CD and developers local machines too. |
We managed to get to .net5 in January and "dotnet build-server shutdown" is working for us. We're about to move to .net6 and we'll test and report back what we find, but we're on Ubuntu 20.04. We'll also likely move from our current Jenkins build to GitHub actions for our pipeline and that will relieve me of worry since the container is ephemeral. You might try containerized runners for your CI/CD of choice. |
The solutions given in this issue do not fully resolve it. Here is what I observe: On MacOS we use Using The exact same build scripts with |
@emmenlau, can you make the CI run What CI are you using anyway? |
@KalleOlaviNiemitalo we have about 200 C++ projects and 2 dotnet projects. I would need to add We're using a self-hosted instance of Gitlab CI, but not with default scripting (which uses platform-dependent shells) but instead with bash-shell on all platforms. |
For anyone who's still fighting with this, check if |
@emmenlau, does the GitLab pipeline system support .NET SDK specifically, or do you just configure it to run |
@emmenlau what version of the .NET SDK are you seeing this behavior on? If you want to disable MSBuild node sharing (which is the default behavior) then you definitely want to use the
for you - and as we add new kinds of build servers we also hook them into this flag. |
@baronfel I'll try that one! So do I understand correctly that |
Too bad there's not a command to start the build server's explicitly. I'm thinking of building a
|
@emmenlau that's correct - though we don't have it documented. I raised dotnet/docs#34903 to cover that. Separately we may need to plumb this through a few other commands that can trigger builds to get full coverage - I'll chat with the team about that:
(Logged #31651 to track this work) ALSO - I believe this option is only available in .NET 7 SDKs onwards, so you'll need that SDK version to take advantage of it. If you're building .NET 6 apps you can still do that from a 7 SDK, so there should be no technical blockers from doing that. |
That is great news, thanks! I'll switch to that flag in the future! For now, I have found that
|
Here's another way: I'm currently using netcore6 on linux (ubuntu/mint flavor) and sometimes the process gets stuck (usually I'm doing some aspnetcore server so the evidence is 'Cannot bind to port x - the address is already in use'). So first I use |
Steps to reproduce
.csproj files attached
buildleak.zip
Enter c directory
Open task manager/details view
observe no dotnet.exe processes are running (clean test environment)
run dotent build
Expected behavior
No dotnet.exe processes left
Actual behavior
dotnet.exe processes left
Environment data
dotnet --info
output:.NET Core SDK (reflecting any global.json):
Version: 2.1.300
Commit: adab45b
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.300\
Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba
.NET Core SDKs installed:
1.0.0 [C:\Program Files\dotnet\sdk]
1.0.1 [C:\Program Files\dotnet\sdk]
1.0.4 [C:\Program Files\dotnet\sdk]
1.1.0 [C:\Program Files\dotnet\sdk]
2.0.0 [C:\Program Files\dotnet\sdk]
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
The text was updated successfully, but these errors were encountered: