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

Bundler hangs on resolving dependencies when a dependency does not support the current platform #6054

Closed
ravron opened this issue Nov 11, 2022 · 3 comments · Fixed by #6070
Closed
Labels

Comments

@ravron
Copy link

ravron commented Nov 11, 2022

Describe the problem as clearly as you can

When a dependency of a gem listed in the Gemfile does not support the current platform, bundler gets stuck in a loop attempting to re-resolve dependencies.

Did you try upgrading rubygems & bundler?

Yes, I'm using bundler 2.3.25.

Post steps to reproduce the problem

First, write the following files to an empty directory:

Gemfile

source 'https://rubygems.org'
ruby '2.7.6'

gem 'sorbet', '= 0.5.10554'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    sorbet (0.5.10554)
      sorbet-static (= 0.5.10554)
    sorbet-static (0.5.10554-universal-darwin-21)

PLATFORMS
  arm64-darwin-21

DEPENDENCIES
  sorbet (= 0.5.10554)

RUBY VERSION
   ruby 2.7.6p219

BUNDLED WITH
   2.3.25

Dockerfile

FROM --platform=linux/arm64 ruby:2.7.6-bullseye

RUN gem install bundler -v 2.3.25
COPY ./Gemfile ./Gemfile.lock ./
RUN bundle install --verbose

Then, in that directory, run docker build --progress=plain --platform=linux/arm64 .. Note that I am doing this on an M1 Mac, which is natively ARM64. I'm not sure whether this docker command will be possible on an x86_64 machine.

Which command did you run?

docker build --progress=plain --platform=linux/arm64 .

What were you expecting to happen?

bundler should fail to install, because sorbet=0.5.10554 depends on sorbet-static=0.5.10554, and sorbet-static=0.5.10554 doesn't support the aarch64-linux platform.

What actually happened?

bundler gets stuck in a loop trying to re-resolve dependencies:

#8 [4/4] RUN bundle install --verbose
#8 sha256:f6cf231e8b9fc7a5dd72a71e5df9d3b2d3fe5bc5f237196009e4a9042face521
#8 0.421 Running `bundle install --verbose` with bundler 2.3.25
#8 0.495 Found no changes, using resolution from the lockfile
#8 0.501 The definition is missing ["sorbet-0.5.10554"]
#8 0.533 HTTP GET https://index.rubygems.org/versions
#8 1.352 HTTP 200 OK https://index.rubygems.org/versions
#8 1.818 Fetching gem metadata from https://rubygems.org/
#8 1.819 Looking up gems ["sorbet", "sorbet-static"]
#8 1.820 HTTP GET https://index.rubygems.org/info/sorbet
#8 1.820 HTTP GET https://index.rubygems.org/info/sorbet-static
#8 1.853 HTTP 200 OK https://index.rubygems.org/info/sorbet
#8 1.995 HTTP 200 OK https://index.rubygems.org/info/sorbet-static
#8 2.321 The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies
#8 2.338 Resolving dependencies...
#8 2.352 The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies
#8 2.352 Resolving dependencies...
#8 2.353 The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies
#8 2.353 Resolving dependencies...
...

If not included with the output of your command, run bundle env and paste the output below

I ran bundle env in the Docker container:

#8 [4/4] RUN bundle env
#8 sha256:f3732424181b06bb7202d0dd5207deb4ba2c2940c6ffbcc3fdf04294c0342725
#8 0.455 ## Environment
#8 0.455
#8 0.455 ```
#8 0.455 Bundler       2.3.25
#8 0.455   Platforms   ruby, aarch64-linux
#8 0.455 Ruby          2.7.6p219 (2022-04-12 revision c9c2245c0a25176072e02db9254f0e0c84c805cd) [aarch64-linux]
#8 0.455   Full Path   /usr/local/bin/ruby
#8 0.455   Config Dir  /usr/local/etc
#8 0.455 RubyGems      3.1.6
#8 0.455   Gem Home    /usr/local/bundle
#8 0.455   Gem Path    /root/.gem/ruby/2.7.0:/usr/local/lib/ruby/gems/2.7.0:/usr/local/bundle
#8 0.455   User Home   /root
#8 0.455   User Path   /root/.gem/ruby/2.7.0
#8 0.455   Bin Dir     /usr/local/bundle/bin
#8 0.455 Tools
#8 0.455   Git         2.30.2
#8 0.455   RVM         not installed
#8 0.455   rbenv       not installed
#8 0.455   chruby      not installed
#8 0.455 ```
#8 0.455
#8 0.455 ## Bundler Build Metadata
#8 0.455
#8 0.455 ```
#8 0.455 Built At          2022-11-02
#8 0.455 Git SHA           6b0b87b1ed
#8 0.455 Released Version  true
#8 0.455 ```
#8 0.455
#8 0.455 ## Bundler settings
#8 0.455
#8 0.455 ```
#8 0.455 app_config
#8 0.455   Set via BUNDLE_APP_CONFIG: "/usr/local/bundle"
#8 0.455 silence_root_warning
#8 0.455   Set via BUNDLE_SILENCE_ROOT_WARNING: true
#8 0.455 ```
#8 0.455
#8 0.455 ## Gemfile
#8 0.455
#8 0.455 ### Gemfile
#8 0.455
#8 0.455 ```ruby
#8 0.455 source 'https://rubygems.org'
#8 0.455 ruby '2.7.6'
#8 0.455
#8 0.455 gem 'sorbet', '= 0.5.10554'
#8 0.455 ```
#8 0.455
#8 0.455 ### Gemfile.lock
#8 0.455
#8 0.455 ```
#8 0.455 GEM
#8 0.455   remote: https://rubygems.org/
#8 0.455   specs:
#8 0.455     sorbet (0.5.10554)
#8 0.455       sorbet-static (= 0.5.10554)
#8 0.455     sorbet-static (0.5.10554-universal-darwin-21)
#8 0.455
#8 0.455 PLATFORMS
#8 0.455   aarch64-linux
#8 0.455
#8 0.455 DEPENDENCIES
#8 0.455   sorbet (= 0.5.10554)
#8 0.455
#8 0.455 RUBY VERSION
#8 0.455    ruby 2.7.6p219
#8 0.455
#8 0.455 BUNDLED WITH
#8 0.455    2.3.25
#8 0.455 ```
@ravron ravron added the Bundler label Nov 11, 2022
@deivid-rodriguez
Copy link
Member

Interestingly and confusingly I just run your repro steps and I got the expected results :/

#8 [4/4] RUN bundle install --verbose
#8 sha256:2735d10581fdefc2eb28239357ba43273cf7f90f8a18231ef97ace7b59ab3549
#8 0.225 Running `bundle install --verbose` with bundler 2.3.25
#8 0.278 Found no changes, using resolution from the lockfile
#8 0.282 The definition is missing ["sorbet-0.5.10554"]
#8 0.302 HTTP GET https://index.rubygems.org/versions
#8 0.581 HTTP 200 OK https://index.rubygems.org/versions
#8 0.861 Fetching gem metadata from https://rubygems.org/
#8 0.862 Looking up gems ["sorbet", "sorbet-static"]
#8 0.863 HTTP GET https://index.rubygems.org/info/sorbet
#8 0.863 HTTP GET https://index.rubygems.org/info/sorbet-static
#8 2.109 HTTP 200 OK https://index.rubygems.org/info/sorbet
#8 2.671 HTTP 200 OK https://index.rubygems.org/info/sorbet-static
#8 2.869 The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies
#8 2.883 Resolving dependencies...
#8 2.898 Resolving dependencies...
#8 2.953 Bundler::VersionConflict: Could not find gem 'sorbet-static (= 0.5.10554)' with platform 'aarch64-linux', which is required by gem 'sorbet (= 0.5.10554)', in rubygems repository https://rubygems.org/ or installed locally.
#8 2.953 
#8 2.953 The source contains the following gems matching 'sorbet-static (= 0.5.10554)':
#8 2.953   * sorbet-static-0.5.10554-java
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-14
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-15
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-16
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-17
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-18
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-19
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-20
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-21
#8 2.953   * sorbet-static-0.5.10554-universal-darwin-22
#8 2.953   * sorbet-static-0.5.10554-x86_64-linux
#8 2.953 /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/resolver.rb:53:in `rescue in start'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/resolver.rb:22:in `start'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/definition.rb:515:in `block in materialize'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/definition.rb:510:in `loop'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/definition.rb:510:in `materialize'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/definition.rb:187:in `specs'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/installer.rb:241:in `ensure_specs_are_compatible!'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/installer.rb:83:in `block in run'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/process_lock.rb:12:in `block in lock'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/process_lock.rb:9:in `open'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/process_lock.rb:9:in `lock'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/installer.rb:71:in `run'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/installer.rb:23:in `install'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/install.rb:62:in `run'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:257:in `block in install'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/settings.rb:131:in `temporary'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:256:in `install'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:31:in `dispatch'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:25:in `start'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/exe/bundle:48:in `block in <top (required)>'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
#8 2.953   /usr/local/bundle/gems/bundler-2.3.25/exe/bundle:36:in `<top (required)>'
#8 2.953   /usr/local/bundle/bin/bundle:23:in `load'
#8 2.953   /usr/local/bundle/bin/bundle:23:in `<main>'
#8 ERROR: executor failed running [/bin/sh -c bundle install --verbose]: exit code: 6

@ravron
Copy link
Author

ravron commented Nov 11, 2022

That's fascinating! I will try to figure out what might be different about my environment. Since it's happening inside a docker container, I'm not sure what it could be.

@ravron
Copy link
Author

ravron commented Nov 11, 2022

Oh, totally my mistake — I messed up the repro steps. I edited the original issue to include the correct Gemfile.lock. The key is the PLATFORMS section: the bug occurs if it contains arm64-darwin-21. If you run through the repro steps again (or just overwrite the Gemfile.lock, which is all I changed), you should be able to repro.

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

Successfully merging a pull request may close this issue.

2 participants