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

0.2.5 fails to load from an incompatible libv8 version update #140

Closed
aprescott opened this issue Apr 29, 2019 · 7 comments
Closed

0.2.5 fails to load from an incompatible libv8 version update #140

aprescott opened this issue Apr 29, 2019 · 7 comments

Comments

@aprescott
Copy link

Summary

On a bundle update mini_racer, 0.2.5 specifies a libv8 version requirement of >= 6.9.411, which doesn't exist. As a result, lib8 version 7.0.276.38.0beta1 is used (a prerelease!), which breaks require "mini_racer", causing execjs to fail to find an available runtime.

Details

I work on an application which saw a version bump from 0.2.4 to 0.2.5. Our CI build started failing when attempting to load the Rails environment:

ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:4:in `<main>'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/usr/local/bundle/gems/uglifier-4.1.20/lib/uglifier.rb:5:in `<main>'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/usr/src/app/config/application.rb:17:in `<top (required)>'

This failure seems to happen because of a problem with mini_racer_extension.so:

irb(main):002:0> require "mini_racer"
Traceback (most recent call last):
       16: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
       15: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
       14: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
       13: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
       12: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:463:in `exec'
       11: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
       10: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
        9: from /usr/local/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
        8: from /usr/local/bin/irb:23:in `<top (required)>'
        7: from /usr/local/bin/irb:23:in `load'
        6: from /usr/local/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        5: from (irb):2
        4: from (irb):2:in `rescue in irb_binding'
        3: from (irb):2:in `require'
        2: from /usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer.rb:2:in `<top (required)>'
        1: from /usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer.rb:2:in `require'
LoadError (/usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer_extension.so: undefined symbol: _ZNKSt3__119__shared_weak_count13__get_deleterERKSt9type_info - /usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer_extension.so)

Looking at the Gemfile.lock diff, there are 2 changes:

-    libv8 (6.7.288.46.1)
+    libv8 (7.0.276.38.0beta1)
-    mini_racer (0.2.4)
-      libv8 (>= 6.3)
+    mini_racer (0.2.5)
+      libv8 (>= 6.9.411)

One thing that stands out is that libv8 has been upgraded from a non-prerelease version to a prerelease version.

A coworker noticed that libv8 version 6.9.411 isn't an available version. What I think is happening is that libv8 version 6.9.411 doesn't exist, so the dependency resolver picks the lowest version higher than 6.9.411, which is 7.0.276.38.0beta1. Unfortunately, it looks like that version isn't compatible with 0.2.5.

Discussion about pinning to 6.9 vs 7.3 seems to have happened as part of #138 (comment).

@ignisf
Copy link
Collaborator

ignisf commented Apr 29, 2019

Hi,

Could you provide the output of gem env and bundle version?

Why would the resolver pick the lowest version higher than 6.9.411? Should it not pick the latest version after 6.9.411? Is this some rubygems/bundler behaviour I am not aware about? @SamSaffron, do you have any hints?

@aprescott
Copy link
Author

aprescott commented Apr 29, 2019

@ignisf sure thing! It's worth noting that this is happening in a Docker environment (host machine is MacOS). docker/run here is an alias for a docker-compose command, although hopefully it's not relevant to the cause of the error.

$ docker/run bundle --version
Running in existing foo-rails container ...
Bundler version 1.17.3
$ docker/run gem env
Running in existing foo-rails container ...
RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3
  - RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/bundle
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bundle/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/bundle
     - /root/.gem/ruby/2.6.0
     - /usr/local/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-document"
     - "update" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bundle/bin
     - /usr/local/bundle/gems/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin

And just for completeness:

$ docker/run 'ruby -e '\''require "mini_racer"'\'
Running in existing foo-rails container ...
Traceback (most recent call last):
	2: from -e:1:in `<main>'
	1: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- mini_racer (LoadError)
	6: from -e:1:in `<main>'
	5: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
	4: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
	3: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
	2: from /usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer.rb:2:in `<top (required)>'
	1: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': /usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer_extension.so: undefined symbol: _ZNKSt3__119__shared_weak_count13__get_deleterERKSt9type_info - /usr/local/bundle/gems/mini_racer-0.2.5/lib/mini_racer_extension.so (LoadError)

@aprescott
Copy link
Author

Why would the resolver pick the lowest version higher than 6.9.411? Should it not pick the latest version after 6.9.411?

That's my understanding, after checking Bundler's 1.17 manpage for bundle update. It isn't clear to me why the lowest version is being selected in this case.

@ignisf
Copy link
Collaborator

ignisf commented Apr 29, 2019

In the meantime I've yanked the 7.0 versions as they were faulty anyway.

@ignisf
Copy link
Collaborator

ignisf commented Apr 29, 2019

You can now try again and see what will happen

@aprescott
Copy link
Author

After looking into this some more, I think the cause is related to a Rubygems mirror caching issue. We're not actually using source "https://rubygems.org/", and switching between sources reveals different behavior: even though our mirror lists 7.3 as available, using the standard public Rubygems sources resolves to libv8 7.3, whereas using the mirror resolves to the 7.0 beta release. I believe we have a work-around with bundle update --full-index, which causes 7.3 to be used.

Apologies for what turned out to be a false bug report. Thank you for responding so quickly.

@ignisf
Copy link
Collaborator

ignisf commented Apr 29, 2019

👍 no worries

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

2 participants