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

bootsnap hiding LoadErrors #218

Closed
sideshowbandana opened this issue Dec 14, 2018 · 8 comments
Closed

bootsnap hiding LoadErrors #218

sideshowbandana opened this issue Dec 14, 2018 · 8 comments

Comments

@sideshowbandana
Copy link

sideshowbandana commented Dec 14, 2018

Hey guys,

I'm not really sure what the right solution is here, but I recently came across this issue when forgetting to include the pg gem in my Gemfile:

When there is a LoadError raised during the app initialization, bootsnap utlimately rescues and re-raises here:
https://github.com/Shopify/bootsnap/blob/master/lib/bootsnap/load_path_cache/core_ext/active_support.rb#L83

The problem is that if Thread.current[:without_bootsnap_cache] is false, the error is ignored and the app continues to load and ultimately fails in another place which hides the actual error.

So, in my case I was getting this:

Traceback (most recent call last):
	102: from bin/rails:3:in `<main>'
	101: from bin/rails:3:in `load'
	100: from /Users/kyle/src/github.com/fitbod/api_v2/bin/spring:15:in `<top (required)>'
	 99: from /Users/kyle/src/github.com/fitbod/api_v2/bin/spring:15:in `require'
	 98: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
	 97: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
	 96: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
	 95: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
	 94: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
	 93: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
	 92: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
	 91: from /Users/kyle/src/github.com/fitbod/api_v2/bin/rails:9:in `<top (required)>'
	 90: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	 89: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	 88: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	 87: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	 86: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	 85: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	 84: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	 83: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	 82: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
	 81: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/command.rb:46:in `invoke'
	 80: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/command/base.rb:65:in `perform'
	 79: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	 78: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	 77: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	 76: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:142:in `perform'
	 75: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:142:in `tap'
	 74: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:147:in `block in perform'
	 73: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:53:in `start'
	 72: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:283:in `start'
	 71: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app'
	 70: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:27:in `app'
	 69: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:219:in `app'
	 68: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config'
	 67: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file'
	 66: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string'
	 65: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval'
	 64: from config.ru:in `<main>'
	 63: from config.ru:in `new'
	 62: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
	 61: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
	 60: from config.ru:3:in `block in <main>'
	 59: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require_relative'
	 58: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	 57: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	 56: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	 55: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	 54: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	 53: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	 52: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	 51: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	 50: from /Users/kyle/src/github.com/fitbod/api_v2/config/environment.rb:5:in `<main>'
	 49: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
	 48: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
	 47: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
	 46: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
	 45: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
	 44: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `call'
	 43: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each'
	 42: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
	 41: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
	 40: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	 39: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
	 38: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
	 37: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
	 36: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
	 35: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
	 34: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/application/finisher.rb:69:in `each'
	 33: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:356:in `eager_load!'
	 32: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:475:in `eager_load!'
	 31: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:475:in `each'
	 30: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:477:in `block in eager_load!'
	 29: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:477:in `each'
	 28: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
	 27: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:246:in `require_dependency'
	 26: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `depend_on'
	 25: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:334:in `depend_on'
	 24: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:45:in `require_or_load'
	 23: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
	 22: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:46:in `block in require_or_load'
	 21: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:356:in `require_or_load'
	 20: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `load_interlock'
	 19: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
	 18: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
	 17: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
	 16: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
	 15: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:378:in `block in require_or_load'
	 14: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	 13: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	 12: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	 11: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	 10: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	  9: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	  8: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	  7: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	  6: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activestorage-5.2.2/app/models/active_storage/blob.rb:16:in `<main>'
	  5: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activestorage-5.2.2/app/models/active_storage/blob.rb:23:in `<class:Blob>'
	  4: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activestorage-5.2.2/app/models/active_storage/blob.rb:23:in `include'
	  3: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/concern.rb:122:in `append_features'
	  2: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/concern.rb:122:in `class_eval'
	  1: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activestorage-5.2.2/app/models/active_storage/blob/representable.rb:9:in `block in <module:Representable>'
/Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `has_one_attached' for #<Class:0x00007fcbdb101d10> (NoMethodError)

instead of this:

126: from bin/rails:3:in `load'
	125: from /Users/kyle/src/github.com/fitbod/foo/bin/spring:15:in `<top (required)>'
	124: from /Users/kyle/src/github.com/fitbod/foo/bin/spring:15:in `require'
	123: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
	122: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
	121: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
	120: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
	119: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
	118: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
	117: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
	116: from /Users/kyle/src/github.com/fitbod/foo/bin/rails:9:in `<top (required)>'
	115: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	114: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	113: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	112: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	111: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	110: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	109: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	108: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	107: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
	106: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/command.rb:46:in `invoke'
	105: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/command/base.rb:65:in `perform'
	104: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	103: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	102: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	101: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:142:in `perform'
	100: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:142:in `tap'
	 99: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:147:in `block in perform'
	 98: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:53:in `start'
	 97: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:283:in `start'
	 96: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app'
	 95: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:27:in `app'
	 94: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:219:in `app'
	 93: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config'
	 92: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file'
	 91: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string'
	 90: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval'
	 89: from config.ru:in `<main>'
	 88: from config.ru:in `new'
	 87: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
	 86: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
	 85: from config.ru:3:in `block in <main>'
	 84: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require_relative'
	 83: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	 82: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	 81: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	 80: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	 79: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	 78: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	 77: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	 76: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	 75: from /Users/kyle/src/github.com/fitbod/foo/config/environment.rb:5:in `<main>'
	 74: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
	 73: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
	 72: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
	 71: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
	 70: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
	 69: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `call'
	 68: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each'
	 67: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
	 66: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
	 65: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	 64: from /Users/kyle/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
	 63: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
	 62: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
	 61: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
	 60: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
	 59: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/application/finisher.rb:69:in `each'
	 58: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:356:in `eager_load!'
	 57: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:475:in `eager_load!'
	 56: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:475:in `each'
	 55: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:477:in `block in eager_load!'
	 54: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:477:in `each'
	 53: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/railties-5.2.2/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
	 52: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:246:in `require_dependency'
	 51: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `depend_on'
	 50: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:334:in `depend_on'
	 49: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:45:in `require_or_load'
	 48: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
	 47: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:46:in `block in require_or_load'
	 46: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:356:in `require_or_load'
	 45: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `load_interlock'
	 44: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
	 43: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
	 42: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
	 41: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
	 40: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:378:in `block in require_or_load'
	 39: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	 38: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	 37: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	 36: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	 35: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	 34: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	 33: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	 32: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	 31: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activestorage-5.2.2/app/models/active_storage/attachment.rb:9:in `<main>'
	 30: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	 29: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	 28: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	 27: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	 26: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	 25: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	 24: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	 23: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	 22: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/base.rb:27:in `<main>'
	 21: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
	 20: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
	 19: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
	 18: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
	 17: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
	 16: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
	 15: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
	 14: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
	 13: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
	 12: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:60:in `establish_connection'
	 11: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:952:in `establish_connection'
	 10: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
	  9: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	  8: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	  7: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	  6: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	  5: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	  4: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
	  3: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	  2: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	  1: from /Users/kyle/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:4:in `<main>'
/Users/kyle/.rvm/gems/ruby-2.5.3/gems/bundler-1.17.1/lib/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'postgresql' Active Record adapter. Missing a gem it depends on? pg is not part of the bundle. Add it to your Gemfile. (LoadError)

Environment

  • ruby-2.5.1
  • Rails 5.2.2

Steps to reproduce:

rails new bar
cd bar
mv config/database.yml config/database.yml.old
sed 's/sqlite3/postgresql/g' config/database.yml.old > config/database.yml
RAILS_ENV=production rails s
@burke
Copy link
Member

burke commented Mar 5, 2019

(sorry for the huge delay in response)

I can't figure out how this would be an issue:

def depend_on(*)
  super
rescue LoadError
  # If we already had cache disabled, there's no use retrying
  raise if Thread.current[:without_bootsnap_cache]
  CoreExt::ActiveSupport.without_bootsnap_cache { super }
end

...inlining that call:

def depend_on(*)
  super
rescue LoadError
  # If we already had cache disabled, there's no use retrying
  raise if Thread.current[:without_bootsnap_cache]
  begin
    prev = Thread.current[:without_bootsnap_cache] || false
    Thread.current[:without_bootsnap_cache] = true
    super
  ensure
    Thread.current[:without_bootsnap_cache] = prev
  end
end

In the case that the first call to super raises a NameError, it should still raise a NameError the second time we call it, right? Maybe not?

@sideshowbandana
Copy link
Author

Hey @burke ,

Thanks for looking into this. It's been a while since I've looked at it myself. Were you able to reproduce it with the steps I listed?

@headius
Copy link

headius commented Mar 16, 2019

I just ran into it while attempting to run some Rails benchmark applications. I had not configured Rails to use a JRuby adapter, but when it tried to load the native CRuby adapter (which was not available of course) it failed in a completely different way, exactly like railsadminteam/rails_admin#3025. Removing bootsnap allowed me to see the original error.

@burke
Copy link
Member

burke commented Mar 19, 2019

I suspect #247 will solve this issue but I haven't found the time to build a reproduction to prove it to myself yet.

@burke
Copy link
Member

burke commented Mar 20, 2019

1.4.2.rc1 is out, I think it fixes this issue.

@sideshowbandana
Copy link
Author

Thanks for working on this.

1.4.2.rc1 is out, I think it fixes this issue.

Were you able to reproduce with:

rails new bar
cd bar
mv config/database.yml config/database.yml.old
sed 's/sqlite3/postgresql/g' config/database.yml.old > config/database.yml
RAILS_ENV=production rails s

@burke
Copy link
Member

burke commented Mar 20, 2019

Ah, still showing the wrong error but at least I have an easy reproduction now. I'll try to get it fixed today. Thanks!

@burke
Copy link
Member

burke commented Mar 20, 2019

If this is not fixed by 1.4.2.rc2, please reopen.

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

3 participants