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

Environment.ProcessorCount does not take into account cgroup/Docker limits #24112

Closed
tmds opened this issue Nov 11, 2017 · 4 comments · Fixed by dotnet/coreclr#15297
Closed
Labels
area-System.Runtime bug os-linux Linux OS (any supported distro)
Milestone

Comments

@tmds
Copy link
Member

tmds commented Nov 11, 2017

This leads to managed code over-dimensioning when running in Docker.

coreclr takes into account docker cpu limits: https://github.com/dotnet/coreclr/blob/dbfd10c94055fb5af823b4a7e30774641afcb3b2/src/classlibnative/bcltype/system.cpp#L349-L350

@tmds tmds changed the title Environment.ProcessorCount does not take into account cgroup limits Environment.ProcessorCount does not take into account cgroup/Docker limits Nov 11, 2017
@terrajobst
Copy link
Member

@stephentoub @weshaggard

@tmds
Copy link
Member Author

tmds commented Nov 27, 2017

@stephentoub @janvorli I'd like to do a PR for this, but I'm not sure how I should call the PAL_GetCpuLimit of coreclr in corefx?

@jkotas
Copy link
Member

jkotas commented Nov 27, 2017

I think we should switch Environment.ProcessorCount to delegate to the runtime:

@tmds
Copy link
Member Author

tmds commented Nov 27, 2017

Thanks @jkotas I will take a shot at implementing that.

@jkotas jkotas closed this as completed Nov 30, 2017
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime bug os-linux Linux OS (any supported distro)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants