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

parallel gem installation with bundler can result in a pacman locking error #397

Open
larskanis opened this issue Nov 15, 2024 · 0 comments

Comments

@larskanis
Copy link
Member

What problems are you experiencing?

With parallel gem installation per bundler can result in a pacman locking error. This can happen when installing multiple gems with msys2_mingw_dependencies metadata set. Parallel install is the default in all recent bundler versions.

Steps to reproduce

With the following Gemfile

source "https://rubygems.org"
gem "psych"    # requests libyaml package
gem "openssl"  # requests openssl package

and both mingw packages libyaml and openssl not yet installed, then the pacman command is executed concurrently, resulting in a locking error:

$ bundle install
Fetching gem metadata from https://rubygems.org/........
Installing psych 5.2.0 with native extensions
Installing openssl 3.2.0 with native extensions
Fehler: Der Vorgang konnte nicht gestartet werden (Kann Datenbank nicht sperren)
Fehler: Datenbank konnte nicht gesperrt werden: File exists
  Wenn Sie sicher sind, dass nicht bereits ein
  Paketmanager läuft, können Sie /var/lib/pacman/db.lck entfernen
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/psych-5.2.0/ext/psych
C:/Ruby33-x64/bin/ruby.exe extconf.rb
checking for pkg-config for yaml-0.1... not found
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include=${opt-dir}/include
        --without-opt-include
        --with-opt-lib=${opt-dir}/lib
        --without-opt-lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby33-x64/bin/$(RUBY_BASE_NAME)
        --with-libyaml-source-dir
        --without-libyaml-source-dir
        --with-yaml-0.1-dir
        --without-yaml-0.1-dir
        --with-yaml-0.1-include=${yaml-0.1-dir}/include
        --without-yaml-0.1-include
        --with-yaml-0.1-lib=${yaml-0.1-dir}/lib
        --without-yaml-0.1-lib
        --with-yaml-0.1-config
        --without-yaml-0.1-config
        --with-pkg-config
        --without-pkg-config
        --with-libyaml-dir
        --without-libyaml-dir
        --with-libyaml-include=${libyaml-dir}/include
        --without-libyaml-include
        --with-libyaml-lib=${libyaml-dir}/lib
        --without-libyaml-lib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

C:/Ruby33-x64/lib/ruby/gems/3.3.0/extensions/x64-mingw-ucrt/3.3.0/psych-5.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/psych-5.2.0 for inspection.
Results logged to
C:/Ruby33-x64/lib/ruby/gems/3.3.0/extensions/x64-mingw-ucrt/3.3.0/psych-5.2.0/gem_make.out

  C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:28:in
`build'
C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:193:in
`build_extension'
C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:227:in `block
in build_extensions'
  C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'
C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:224:in
`build_extensions'
C:/Ruby33-x64/lib/ruby/site_ruby/3.3.0/rubygems/installer.rb:844:in
`build_extensions'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/rubygems_gem_installer.rb:111:in
`build_extensions'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/rubygems_gem_installer.rb:30:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/source/rubygems.rb:205:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/installer/gem_installer.rb:55:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/installer/gem_installer.rb:17:in
`install_from_spec'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/installer/parallel_installer.rb:133:in
`do_install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/installer/parallel_installer.rb:124:in
`block in worker_pool'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/worker.rb:62:in
`apply_func'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/worker.rb:57:in
`block in process_queue'
  <internal:kernel>:187:in `loop'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/worker.rb:54:in
`process_queue'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing psych (5.2.0), and Bundler cannot continue.

In Gemfile:
  psych

A second attempt succeeds, since only one package is missing now:

$ bundle install
Fetching gem metadata from https://rubygems.org/........
Installing psych 5.2.0 with native extensions
Updating files in vendor/cache
Bundle complete! 2 Gemfile dependencies, 4 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

What's the output from ridk version?

---
ruby:
  path: C:/Ruby33-x64
  version: 3.3.5
  platform: x64-mingw-ucrt
ruby_installer:
  package_version: 3.3.5-1
  git_commit: 70d8ddb
msys2:
  path: C:\Ruby33-x64\msys64
cc: gcc (Rev1, Built by MSYS2 project) 14.2.0
sh: GNU bash, Version 5.2.32(1)-release (x86_64-pc-msys)
os: Microsoft Windows [Version 10.0.22631.4317]
larskanis added a commit that referenced this issue Nov 21, 2024
pacman invocation must be serialized to avoid locking error.

Fixes #397
larskanis added a commit that referenced this issue Nov 21, 2024
pacman invocation must be serialized to avoid locking error.

Fixes #397
larskanis added a commit that referenced this issue Nov 21, 2024
pacman invocation must be serialized to avoid locking error.

Fixes #397
larskanis added a commit that referenced this issue Nov 21, 2024
pacman invocation must be serialized to avoid locking error.

Fixes #397
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

No branches or pull requests

1 participant