mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
![]() I did a bad thing (script that edits the Gemfile.lock directly) and
ended up with a Gemfile.lock that was completely missing some indirect
dependencies. While this is my fault and an error is reasonable, I
noticed that the error got progressively less friendly in recent
versions of bundler.
Something similar came up in https://github.com/rubygems/rubygems/issues/6210,
and this commit would have helped with that case as well
(although we've already handled this a different way with #6219).
Details:
---
Back on Bundler 2.2.23, a corrupt lockfile like this would cause a helpful error:
```
Unable to find a spec satisfying minitest (>= 5.1) in the set. Perhaps the lockfile is corrupted?
```
Bundler 2.3.26 gave a helpful warning:
```
Warning:
Your lockfile was created by an old Bundler that left some things out.
Because of the missing DEPENDENCIES, we can only install gems one at a time,
instead of installing 16 at a time.
You can fix this by adding the missing gems to your Gemfile, running bundle
install, and then removing the gems from your Gemfile.
The missing gems are:
* minitest depended upon by activesupport
```
But then continued on and crashed while trying to report the unmet
dependency:
```
--- ERROR REPORT TEMPLATE -------------------------------------------------------
NoMethodError: undefined method `full_name' for nil:NilClass
lib/bundler/installer/parallel_installer.rb:127:in `block (2 levels) in check_for_unmet_dependencies'
...
```
Bundler 2.4.0 and up crash as above when jobs=1, but crash
even harder when run in parallel:
```
--- ERROR REPORT TEMPLATE -------------------------------------------------------
fatal: No live threads left. Deadlock?
3 threads, 3 sleeps current:0x00007fa6b6704660 main thread:0x00007fa6b6704660
* #<Thread:0x000000010833b130 sleep_forever>
rb_thread_t:0x00007fa6b6704660 native:0x0000000108985600 int:0
* #<Thread:0x0000000108dea630@Parallel Installer Worker #0 tmp/1/gems/system/gems/bundler-2.5.0.dev/lib/bundler/worker.rb:90 sleep_forever>
rb_thread_t:0x00007fa6b67f67c0 native:0x0000700009a62000 int:0
* #<Thread:0x0000000108dea4a0@Parallel Installer Worker #1 tmp/1/gems/system/gems/bundler-2.5.0.dev/lib/bundler/worker.rb:90 sleep_forever>
rb_thread_t:0x00007fa6b67f63c0 native:0x0000700009c65000 int:0
<internal:thread_sync>:18:in `pop'
tmp/1/gems/system/gems/bundler-2.5.0.dev/lib/bundler/worker.rb:42:in `deq'
...
```
Changes
---
This commit fixes the confusing thread deadlock crash by detecting if
dependencies are missing such that we'll never be able to enqueue. When
that happens we treat it as a failure so the install can finish.
That gets us back to the `NoMethodError`, which this commit fixes by
using a different warning in the case where no spec is found.
|
||
---|---|---|
.. | ||
cli | ||
compact_index_client | ||
fetcher | ||
installer | ||
man | ||
plugin | ||
resolver | ||
settings | ||
source | ||
templates | ||
ui | ||
vendor | ||
.document | ||
build_metadata.rb | ||
bundler.gemspec | ||
capistrano.rb | ||
cli.rb | ||
compact_index_client.rb | ||
constants.rb | ||
current_ruby.rb | ||
definition.rb | ||
dependency.rb | ||
deployment.rb | ||
deprecate.rb | ||
digest.rb | ||
dsl.rb | ||
endpoint_specification.rb | ||
env.rb | ||
environment_preserver.rb | ||
errors.rb | ||
feature_flag.rb | ||
fetcher.rb | ||
force_platform.rb | ||
friendly_errors.rb | ||
gem_helper.rb | ||
gem_helpers.rb | ||
gem_tasks.rb | ||
gem_version_promoter.rb | ||
graph.rb | ||
index.rb | ||
injector.rb | ||
inline.rb | ||
installer.rb | ||
lazy_specification.rb | ||
lockfile_generator.rb | ||
lockfile_parser.rb | ||
match_metadata.rb | ||
match_platform.rb | ||
match_remote_metadata.rb | ||
mirror.rb | ||
plugin.rb | ||
process_lock.rb | ||
remote_specification.rb | ||
resolver.rb | ||
retry.rb | ||
ruby_dsl.rb | ||
ruby_version.rb | ||
rubygems_ext.rb | ||
rubygems_gem_installer.rb | ||
rubygems_integration.rb | ||
runtime.rb | ||
self_manager.rb | ||
settings.rb | ||
setup.rb | ||
shared_helpers.rb | ||
similarity_detector.rb | ||
source.rb | ||
source_list.rb | ||
source_map.rb | ||
spec_set.rb | ||
stub_specification.rb | ||
ui.rb | ||
uri_credentials_filter.rb | ||
vendored_fileutils.rb | ||
vendored_persistent.rb | ||
vendored_pub_grub.rb | ||
vendored_thor.rb | ||
vendored_tsort.rb | ||
vendored_uri.rb | ||
version.rb | ||
vlad.rb | ||
worker.rb | ||
yaml_serializer.rb |