Skip to content

[bug][critical] cpu detection: detect the number of online CPU - #41144

Closed
morotti wants to merge 2 commits into
grpc:masterfrom
morotti:patch-1
Closed

morotti wants to merge 2 commits into
grpc:masterfrom
morotti:patch-1

Conversation

@morotti

@morotti morotti commented Nov 27, 2025 •

Copy link
Copy Markdown

hello,

see ticket #40991

critical fix to detect the number of online CPU

on a LXC node with 8 CPU.

  • _SC_NPROCESSORS_ONLN gives 8 CPU. the correct number.
  • _SC_NPROCESSORS_CONF gives 256 CPU, which is the hardware on the hypervisor. this is not correct and cannot be used by the application.

regards.

…ffline CPU

on a LXC node with 8 CPU.

_SC_NPROCESSORS_ONLN gives 8 CPU.
_SC_NPROCESSORS_CONF gives 256 CPU, which is the hardware on the hypervisor not the VM.
@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 27, 2025 •

Copy link
Copy Markdown

CLA Not Signed

@morotti

morotti commented Nov 27, 2025

Copy link
Copy Markdown
Author

@rishesh007 you were assigned to the attached ticket. can you have a look?
or @tanvi-jagtap @siddharthnohria who appear to be maintainers of this repo.

I am not interested in signing the long CLA.
I'd appreciate if you can make the patch yourself.

Thank you :)

@pawbhard

pawbhard commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Closing this due to not agreeing for CLA

@pawbhard pawbhard closed this Jan 6, 2026
@morotti

morotti commented Jan 6, 2026

Copy link
Copy Markdown
Author

@pawbhard please reopen the ticket and take the patch. I don't need to sign the CLA. you can make a PR to change the 1 line of code that's bugged.

@pawbhard

pawbhard commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

@morotti , Ticket is open we will evaluate that seperately from this PR. Due to legal reason we cannot take patch or look at code if CLA is not signed. Thanks

@morotti

morotti commented Jan 7, 2026

Copy link
Copy Markdown
Author

hello, in the interest of making your life easier and not reading the patch. you simply need to replace _SC_NPROCESSORS_CONF with _SC_NPROCESSORS_ONLN, to return the correct number of CPU.

I initially found the bug in ray, which is using grpc.
screenshot here, _SC_NPROCESSORS_CONF returns 256 cores on a VM which is the number of cores on the host, _SC_NPROCESSORS_ONLN returns 16 cores which is the correct number of CPU cores on the VM. ray-project/ray#59041 (comment)

copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2026
fixing Bug#1 for #41144

Closes #41585

COPYBARA_INTEGRATE_REVIEW=#41585 from rishesh007:cpu_env_fix 8829376
PiperOrigin-RevId: 952012413
grohman-hub pushed a commit to grohman-hub/grpc that referenced this pull request Jul 23, 2026
fixing Bug#1 for grpc#41144

Closes grpc#41585

COPYBARA_INTEGRATE_REVIEW=grpc#41585 from rishesh007:cpu_env_fix 8829376
PiperOrigin-RevId: 952012413
grohman-hub pushed a commit to grohman-hub/grpc that referenced this pull request Jul 23, 2026
fixing Bug#1 for grpc#41144

Closes grpc#41585

COPYBARA_INTEGRATE_REVIEW=grpc#41585 from rishesh007:cpu_env_fix 8829376
PiperOrigin-RevId: 952012413
asheshvidyut pushed a commit to PeterZhizhin/grpc that referenced this pull request Nov 12, 2026
fixing Bug#1 for grpc#41144

Closes grpc#41585

COPYBARA_INTEGRATE_REVIEW=grpc#41585 from rishesh007:cpu_env_fix 8829376
PiperOrigin-RevId: 952012413
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants