Shopify / bootsnap

Boot large Ruby/Rails apps faster
MIT License
2.68k stars 183 forks source link

Unable to load ActiveSupport 5.1 (Ruby 2.5.1) #176

Closed lzap closed 6 years ago

lzap commented 6 years ago

Hello, I am trying bootsnap again with our rather large Rails app, but hitting this load problem. Looks like bootsnap is unable to load ActiveSupport in early stage:

Traceback (most recent call last):
        21: from ./bin/rails:3:in `<main>'
        20: from ./bin/rails:3:in `load'
        19: from /home/lzap/work/foreman/bin/spring:13:in `<top (required)>'
        18: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
        17: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
        16: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
        15: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
        14: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
        13: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
        12: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
        11: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
        10: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
         9: from /home/lzap/work/foreman/bin/rails:8:in `<top (required)>'
         8: from /home/lzap/work/foreman/bin/rails:8:in `require_relative'
         7: from /home/lzap/work/foreman/config/boot.rb:7:in `<top (required)>'
         6: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
         5: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
         4: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
         3: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/setup.rb:33:in `<top (required)>'
         2: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap.rb:24:in `setup'
         1: from /home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache.rb:39:in `setup'
/home/lzap/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- active_support/dependencies (LoadError)

List of gems:

Using actioncable 5.1.6
Using actionmailer 5.1.6
Using actionpack 5.1.6
Using actionview 5.1.6
Using activejob 5.1.6
Using activemodel 5.1.6
Using activerecord-session_store 1.1.1
Using activerecord 5.1.6
Using activesupport 5.1.6
Using addressable 2.5.2
Using algebrick 0.7.5
Using ancestry 3.0.2
Using apipie-params 0.0.5
Using apipie-rails 0.5.9
Using arel 8.0.0
Using as_deprecation_tracker 1.5.0
Using ast 2.4.0
Using audited 4.7.1
Using autoparse 0.3.3
Using autoprefixer-rails 8.6.5
Using awesome_print 1.8.0
Using benchmark-ips 2.7.2
Using bootsnap 1.3.0
Using bootstrap-sass 3.3.7
Using builder 3.2.3
Using bullet 5.7.5
Using bundler 1.16.1
Using capybara-screenshot 1.0.21
Using capybara 3.3.1
Using CFPropertyList 2.3.6
Using ci_reporter_minitest 1.0.0
Using ci_reporter 2.0.0
Using cliver 0.3.2
Using coderay 1.1.2
Using coffee-rails 4.2.2
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using concurrent-ruby-edge 0.2.4
Using concurrent-ruby 1.0.5
Using crack 0.4.3
Using crass 1.0.4
Using css_parser 1.6.0
Using daemons 1.2.6
Using database_cleaner 1.7.0
Using deacon 1.0.0
Using deep_cloneable 2.3.2
Using domain_name 0.5.20180417
Using dynflow 1.1.0
Using erubi 1.7.1
Using excon 0.62.0
Using execjs 2.7.0
Using extlib 0.9.16
Using facter 2.5.1
Using factory_bot_rails 4.10.0
Using factory_bot 4.10.0
Using faraday 0.15.2
Using fast_gettext 1.7.0
Using fission 0.5.0
Using fog-aliyun 0.3.2
Using fog-atmos 0.1.0
Using fog-aws 1.4.1
Using fog-brightbox 0.15.0
Using fog-cloudatcost 0.1.2
Using fog-core 1.45.0
Using fog-digitalocean 0.3.0
Using fog-dnsimple 1.0.0
Using fog-dynect 0.0.3
Using fog-ecloud 0.3.0
Using fog-google 0.1.0
Using fog-internet-archive 0.0.1
Using fog-joyent 0.0.1
Using fog-json 1.2.0
Using fog-libvirt 0.5.0
Using fog-local 0.5.0
Using fog-openstack 0.1.27
Using fog-ovirt 1.0.4
Using fog-powerdns 0.2.0
Using fog-profitbricks 4.1.1
Using fog-rackspace 0.1.5
Using fog-radosgw 0.0.5
Using fog-riakcs 0.1.0
Using fog-sakuracloud 1.7.5
Using fog-serverlove 0.1.2
Using fog-softlayer 1.1.4
Using fog-storm_on_demand 0.1.1
Using fog-terremark 0.1.0
Using fog-vmfusion 0.1.0
Using fog-voxel 0.1.0
Using fog-vsphere 2.3.0
Using fog-xenserver 0.3.0
Using fog-xml 0.1.3
Using fog 1.42.0
Using font-awesome-sass 4.6.2
Using foreman_bootdisk 12.0.0 from source at `../foreman_bootdisk/`
Using foreman_discovery 12.0.0 from source at `../foreman_discovery/`
Using foreman_hooks 0.3.14 from source at `../foreman_hooks/`
Using foreman 0.85.0
Using formatador 0.2.5
Using friendly_id 5.2.4
Using get_process_mem 0.2.2
Using gettext_i18n_rails_js 1.3.0
Using gettext_i18n_rails 1.8.0
Using gettext 3.2.9
Using globalid 0.4.1
Using google-api-client 0.8.6
Using googleauth 0.6.2
Using gridster-rails 0.5.6.1
Using hashdiff 0.3.7
Using hirb-unicode-steakknife 0.0.8
Using hirb 0.7.3
Using http-cookie 1.0.3
Using immigrant 0.3.6
Using inflecto 0.0.2
Using ipaddress 0.8.3
Using i18n 1.0.1
Using journald-logger 2.0.3
Using journald-native 1.0.10
Using jquery-turbolinks 2.1.0
Using jquery-ui-rails 4.2.1
Using json 2.1.0
Using jwt 2.1.0
Using launchy 2.4.3
Using ldap_fluff 0.4.7
Using little-plugger 1.1.4
Using locale 2.1.2
Using logging-journald 1.0.0
Using logging 2.2.2
Using lol_dba 2.1.5
Using loofah 2.2.2
Using mail 2.7.0
Using maruku 0.7.3
Using memoist 0.16.0
Using metaclass 0.0.4
Using method_source 0.9.0
Using mime-types-data 3.2016.0521
Using mime-types 3.1
Using mini_mime 1.0.0
Using mini_portile2 2.3.0
Using minitest-retry 0.1.9
Using minitest-spec-rails 5.4.0
Using minitest 5.10.3
Using mocha 1.5.0
Using msgpack 1.2.4
Using multi_json 1.13.1
Using multipart-post 2.0.0
Using mysql2 0.5.2
Using net-ldap 0.16.1
Using net-ping 2.0.4
Using netrc 0.11.0
Using net-scp 1.2.1
Using net-ssh 5.0.2
Using nio4r 2.3.1
Using nokogiri 1.8.4
Using oauth 0.5.4
Using os 0.9.6
Using ovirt-engine-sdk 4.2.4
Using paint 2.0.1
Using parallel_tests 2.21.3
Using parallel 1.12.1
Using parser 2.5.1.2
Using patternfly-sass 3.32.1
Using pg 1.0.0
Using poltergeist 1.18.1
Using po_to_json 1.0.1
Using powerpack 0.1.2
Using prometheus-client 0.8.0
Using pry-rails 0.3.6
Using pry 0.11.3
Using public_suffix 3.0.2
Using puma 3.11.4
Using quantile 0.2.1
Using rabl 0.13.1
Using rack-jsonp 1.3.1
Using rack-openid 1.4.2
Using rack-test 1.0.0
Using rack 2.0.5
Using rails-controller-testing 1.0.2
Using rails-dom-testing 2.0.3
Using rails-html-sanitizer 1.0.4
Using rails-i18n 5.1.1
Using rails 5.1.6
Using railties 5.1.6
Using rainbow 3.0.0
Using rake 12.3.1
Using rbovirt 0.1.6
Using rbvmomi 1.13.0
Using record_tag_helper 1.0.0
Using responders 2.4.0
Using rest-client 2.0.2
Using retriable 1.4.1
Using rfauxfactory 0.1.5
Using roadie-rails 1.3.0
Using roadie 3.4.0
Using robottelo_reporter 0.1.1
Using rubocop-checkstyle_formatter 0.4.0
Using rubocop 0.54.0
Using ruby-libvirt 0.7.1
Using ruby-openid 2.7.0
Using ruby_parser 3.11.0
Using ruby-progressbar 1.9.0
Using ruby2ruby 2.4.1
Using safemode 1.3.5
Using safe_yaml 1.0.4
Using sass-rails 5.0.7
Using sass 3.4.25
Using scoped_search 4.1.3
Using secure_headers 5.0.5
Using sequel 5.10.0
Using sexp_processor 4.11.0
Using shoulda-context 1.2.2
Using shoulda-matchers 3.1.2
Using show_me_the_cookies 4.0.0
Using signet 0.8.1
Using single_test 0.6.0
Using spice-html5-rails 0.1.5
Using spring 2.0.2
Using sprockets-rails 3.2.1
Using sprockets 3.7.2
Using sqlite3 1.3.13
Using sshkey 1.9.0
Using statsd-instrument 2.2.1
Using text 1.3.1
Using thor 0.19.4
Using thread_safe 0.3.6
Using tilt 2.0.8
Using trollop 2.1.2
Using turbolinks 2.5.4
Using tzinfo 1.2.5
Using uglifier 4.1.14
Using unf_ext 0.0.7.5
Using unf 0.1.4
Using unicode-display_width 1.4.0
Using uniform_notifier 1.11.0
Using useragent 0.16.10
Using validates_lengths_from_database 0.7.0
Using webmock 3.4.2
Using webpack-rails 0.9.11
Using websocket-driver 0.6.5
Using websocket-extensions 0.1.3
Using will_paginate 3.1.6
Using wirb 2.1.2
Using x-editable-rails 1.5.5.1
Using xml-simple 1.1.5
Using xpath 3.1.0

Any tips how to troubleshoot this?

rafaelfranca commented 6 years ago

Where did you put the bootsnap/setup call? Was it after the bundler/setup call? If you try to require active_support/dependencies after the bundle/setup and before bootsnap/setup does it work?

lzap commented 6 years ago

It is little bit more complicated in our case, we use bundler_ext gem which is just a stub, it "removes" bundler in production (we deploy via traditional RPM packaging). But this should not be relevant - in test/dev setups we normally use bundler:

https://github.com/lzap/foreman/blob/bootsnap-21833/config/boot.rb#L7

rafaelfranca commented 6 years ago

I see. Yours bootstrap/setup require seems to be before bundler is activated so it can't find activesupport gem since bundler is not activated yet.

Have you tried to add a require 'active_support/dependencies before requiring bootsnap/setup to see if that require would also fail?

lzap commented 6 years ago

Thanks, that does the trick!