Skip to content

Running make with -j causes issues in docker environments #9170

@rzane

Description

@rzane

Describe the problem as clearly as you can

After upgrading to RubyGems v4, the bundle install step in our CI runs started getting killed by the OS. Eventually, we found this change, which makes RubyGems run make with the -j flag.

In Docker environments, Etc.nprocessors often reports the wrong number of CPUs. Etc.nprocessors was reporting the number of available CPUs on the host machine, which was much larger than the number of CPUs that are actually available. As a result, the install process was getting killed.

The current workaround is to explicitly configure MAKEFLAGS like this:

export MAKEFLAGS=-j2

We found it very surprising and unintuitive that the number of make jobs is not synchronized with Bundler's jobs configuration.

I propose reverting this change, since it's going to cause a lot of headaches. Instead, I think this change should be implemented in Bundler, which already has a jobs setting.

Alternatively, documenting this workaround and calling it out explicitly in the changelog would have been tremendously helpful for us.

Did you try upgrading RubyGems?

I encountered this issue on the latest version of rubygems.

Post steps to reproduce the problem

Which command did you run?

I ran bundle install.

What were you expecting to happen?

I was expecting all parallelization during bundle install to be configurable with bundle config set jobs $NUMBER.

What actually happened?

Setting bundle config set jobs $NUMBER limited bundler's concurrency, but it did not limit make's concurrency.

Run gem env and paste the output below

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions