Skip to content

Fix worker processes not starting up due to 0 processes

Stan Hu requested to merge sh-handle-zero-threads-per-core into master

What does this MR do?

The update to CINC 17.10 in !6048 (merged) updated Ohai to v17.9.0. As a result of https://github.com/chef/ohai/pull/1454, lscpu is used to determine the number of real cores, total CPUs, and threads per core. However, on some older platforms, threads per core is 0, resulting in the total number of virtual CPUs being 0. This would cause NGINX to spin up with 0 cores.

To prevent startup failures, we now attempt to fallback to the number of cores. Failing that, for NGINX we set the minimum worker processes to 1.

We also convert to using dig in case the CPU data is not available for some reason.

Related issues

Relates to:

Upstream fix: https://github.com/chef/ohai/pull/1756

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for the GitLab Chart opened
Edited by Stan Hu

Merge request reports