Skip to content

Improve CLI parallelism #501

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

Merged
merged 3 commits into from
May 14, 2025
Merged

Improve CLI parallelism #501

merged 3 commits into from
May 14, 2025

Conversation

casperisfine
Copy link
Contributor

  • Avoid spawning more processes than what the cgroups cpu quota allows.
  • Try to detect QEMU fork bug.

Fix: #495
Closes: #497

I'm waiting on a confirmation that the bug detection work as expected, once I have it I'll cut a release.

@casperisfine casperisfine force-pushed the improve-parallelism branch from ddb66a9 to 5cc0f1f Compare May 14, 2025 16:12
When building cross platform images with Docker,
QEMU is often used under the hood and can have a bug
that cause forked processes to deadlock.

Before spawning workers we test for that bug.

Fix: #495
Closes: #497

Co-Authored-By: Sarun Rattanasiri <[email protected]>
@casperisfine casperisfine force-pushed the improve-parallelism branch from 5cc0f1f to d603b70 Compare May 14, 2025 16:13
@casperisfine casperisfine merged commit dcd9327 into main May 14, 2025
16 checks passed
@casperisfine casperisfine deleted the improve-parallelism branch May 14, 2025 16:24
return nil if cpu_max.start_with?("max ") # no limit

max, period = cpu_max.split.map(&:to_f)
max / period
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines (and lines 53/54) are returning a float, causing issues later on when trying to spawn the worker pool. This is the error from our CI:

/home/circleci/tmp/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.18.5/lib/bootsnap/cli/worker_pool.rb:164:in `spawn': undefined method `times' for 4.0:Float (NoMethodError)

        @workers = @size.times.map { Worker.new(@jobs) }
                        ^^^^^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootsnap causes kamal setup to hang in Ruby 3.3.5
3 participants