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

Rails 6.1.5 fails to launch rails server with config.eager_load = true #44876

Closed
krhitoshi opened this issue Apr 12, 2022 · 4 comments
Closed

Comments

@krhitoshi
Copy link

krhitoshi commented Apr 12, 2022

Steps to reproduce

$ docker run -it --name rails6.1 --rm ruby:3.1.1 bash
# gem install rails -v 6.1.5
# rails new myapp
# cd myapp/

# curl -sL https://deb.nodesource.com/setup_14.x | bash - && wget -O - https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y --no-install-recommends nodejs yarn
# rails webpacker:install

# rails server -e production

Expected behavior

You can launch rails server in both development and production.
Here is the behavior of Rails 7.0.2.3 with Ruby 3.1.1.

$ docker run -it --name rails7.0 --rm ruby:3.1.1 bash
# gem install rails -v 7.0.2.3
# rails new myapp
# cd myapp/

# rails server
=> Booting Puma
=> Rails 7.0.2.3 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 3.1.1-p18) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 513
* Listening on http://127.0.0.1:3000
Use Ctrl-C to stop

# rails server -e production
=> Booting Puma
=> Rails 7.0.2.3 application starting in production
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 3.1.1-p18) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: production
*          PID: 525
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop

Mail.eager_autoload! and Mail.new works well on rails console.

# rails console
Loading development environment (Rails 7.0.2.3)
irb(main):001:0>  Mail.eager_autoload!
=>
{:SMTP=>"mail/network/delivery_methods/smtp",
 :FileDelivery=>"mail/network/delivery_methods/file_delivery",
 :LoggerDelivery=>"mail/network/delivery_methods/logger_delivery",
 :Sendmail=>"mail/network/delivery_methods/sendmail",
 :Exim=>"mail/network/delivery_methods/exim",
 :SMTPConnection=>"mail/network/delivery_methods/smtp_connection",
 :TestMailer=>"mail/network/delivery_methods/test_mailer",
 :POP3=>"mail/network/retriever_methods/pop3",
 :IMAP=>"mail/network/retriever_methods/imap",
 :TestRetriever=>"mail/network/retriever_methods/test_retriever",
 :UnstructuredField=>"mail/fields/unstructured_field",
 :StructuredField=>"mail/fields/structured_field",
 :OptionalField=>"mail/fields/optional_field",
 :BccField=>"mail/fields/bcc_field",
 :CcField=>"mail/fields/cc_field",
 :CommentsField=>"mail/fields/comments_field",
 :ContentDescriptionField=>"mail/fields/content_description_field",
 :ContentDispositionField=>"mail/fields/content_disposition_field",
 :ContentIdField=>"mail/fields/content_id_field",
 :ContentLocationField=>"mail/fields/content_location_field",
 :ContentTransferEncodingField=>"mail/fields/content_transfer_encoding_field",
 :ContentTypeField=>"mail/fields/content_type_field",
 :DateField=>"mail/fields/date_field",
 :FromField=>"mail/fields/from_field",
 :InReplyToField=>"mail/fields/in_reply_to_field",
 :KeywordsField=>"mail/fields/keywords_field",
 :MessageIdField=>"mail/fields/message_id_field",
 :MimeVersionField=>"mail/fields/mime_version_field",
 :ReceivedField=>"mail/fields/received_field",
 :ReferencesField=>"mail/fields/references_field",
 :ReplyToField=>"mail/fields/reply_to_field",
 :ResentBccField=>"mail/fields/resent_bcc_field",
 :ResentCcField=>"mail/fields/resent_cc_field",
 :ResentDateField=>"mail/fields/resent_date_field",
 :ResentFromField=>"mail/fields/resent_from_field",
 :ResentMessageIdField=>"mail/fields/resent_message_id_field",
 :ResentSenderField=>"mail/fields/resent_sender_field",
 :ResentToField=>"mail/fields/resent_to_field",
 :ReturnPathField=>"mail/fields/return_path_field",
 :SenderField=>"mail/fields/sender_field",
 :SubjectField=>"mail/fields/subject_field",
 :ToField=>"mail/fields/to_field",
 :Parsers=>"mail/parsers",
 :Address=>"mail/elements/address",
 :AddressList=>"mail/elements/address_list",
 :ContentDispositionElement=>"mail/elements/content_disposition_element",
 :ContentLocationElement=>"mail/elements/content_location_element",
 :ContentTransferEncodingElement=>"mail/elements/content_transfer_encoding_element",
 :ContentTypeElement=>"mail/elements/content_type_element",
 :DateTimeElement=>"mail/elements/date_time_element",
 :EnvelopeFromElement=>"mail/elements/envelope_from_element",
 :MessageIdsElement=>"mail/elements/message_ids_element",
 :MimeVersionElement=>"mail/elements/mime_version_element",
 :PhraseList=>"mail/elements/phrase_list",
 :ReceivedElement=>"mail/elements/received_element"}
irb(main):002:0> Mail.new
=> #<Mail::Message:29080, Multipart: false, Headers: >

Rails 6.1.5 with Ruby 3.0.3 worked as well, anyway.

Actual behavior

You can launch rails server in development. But not in production.

# rails server
=> Booting Puma
=> Rails 6.1.5 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 3.1.1-p18) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 2956
* Listening on http://127.0.0.1:3000
Use Ctrl-C to stop

# rails server -e production
=> Booting Puma
=> Rails 6.1.5 application starting in production
=> Run `bin/rails server --help` for more startup options
Exiting
/usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/delivery_methods.rb:42:in `<module:ClassMethods>': uninitialized constant Mail::TestMailer (NameError)

      delegate :deliveries, :deliveries=, to: Mail::TestMailer
                                                  ^^^^^^^^^^^^
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/delivery_methods.rb:40:in `<module:DeliveryMethods>'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/delivery_methods.rb:8:in `<module:ActionMailer>'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/delivery_methods.rb:5:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/base.rb:438:in `<class:Base>'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/base.rb:437:in `<module:ActionMailer>'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer/base.rb:12:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /myapp/app/mailers/application_mailer.rb:1:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:27:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader/helpers.rb:95:in `const_get'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader/helpers.rb:95:in `cget'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader.rb:237:in `block (2 levels) in eager_load'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader/helpers.rb:26:in `block in ls'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader/helpers.rb:18:in `each_child'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader/helpers.rb:18:in `ls'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader.rb:232:in `block in eager_load'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader.rb:217:in `synchronize'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader.rb:217:in `eager_load'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader.rb:317:in `each'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/loader.rb:317:in `eager_load_all'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application/finisher.rb:133:in `block in <module:Finisher>'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:32:in `run'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `call'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:60:in `run_initializers'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application.rb:391:in `initialize!'
	from /myapp/config/environment.rb:5:in `<main>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in start'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:379:in `handle_profiling'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:311:in `start'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:39:in `start'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:144:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:135:in `perform'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/command/base.rb:69:in `perform'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/command.rb:48:in `invoke'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands.rb:18:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /myapp/bin/rails:5:in `<top (required)>'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in `load'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in `call'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/command.rb:7:in `call'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client.rb:30:in `run'
	from /usr/local/bundle/gems/spring-4.0.0/bin/spring:49:in `<top (required)>'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `load'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `<top (required)>'
	from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /myapp/bin/spring:10:in `block in <top (required)>'
	from <internal:kernel>:90:in `tap'
	from /myapp/bin/spring:7:in `<top (required)>'
	from bin/rails:2:in `load'
	from bin/rails:2:in `<main>'

I found that it is possible to launch rails server even in production when I disable config.eager_load.

# apt update
# apt install vim
# vi config/environments/production.rb
  #config.eager_load = true
  config.eager_load = false

# rails server -e production
=> Booting Puma
=> Rails 6.1.5 application starting in production
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 3.1.1-p18) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: production
*          PID: 2945
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop

Mail module seems to work strangely.
Either Mail.eager_autoload! or Mail.new does not work well on rails console.

# rails console
Running via Spring preloader in process 2986
Loading development environment (Rails 6.1.5)
irb(main):001:0> Mail.eager_autoload!
(irb):1:in `<main>': undefined method `eager_autoload!' for Mail:Module (NoMethodError)
irb(main):002:0> Mail.new
(irb):2:in `<main>': undefined method `new' for Mail:Module (NoMethodError)

System configuration

Rails version: 6.1.5

Ruby version: 3.1.1

@eileencodes
Copy link
Member

This sounds like a problem with Ruby 3.1 and the mail gem. We had to make these changes in #44600 because required changes aren't getting merged into mail. I see you're on 6.1.5 so this should have fixed any issues you were having. Can you try explicitly adding the net-smtp gem to your Gemfile and observe if that fixes the issue? You should be able to test this without deploying to production by changing the config.eager_load in development to true.

@skipkayhil
Copy link
Member

Can you try explicitly adding the net-smtp gem to your Gemfile and observe if that fixes the issue?

This is almost definitely the fix. The regex in 6.1.5 swallows the net-smtp LoadError, and was fixed in #44697

@krhitoshi
Copy link
Author

Adding net-smtp, net-pop and net-imap in Gemfile fixed this issue. Thank you!

# vi Gemfile
gem 'net-smtp'
gem 'net-pop'
gem 'net-imap'

# bundle install

# vi config/environments/development.rb
  config.eager_load = true

# rails server
=> Booting Puma
=> Rails 6.1.5 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 3.1.1-p18) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 3007
* Listening on http://127.0.0.1:3000
Use Ctrl-C to stop

Here are the errors for net-pop and net-imap.

# rails server
=> Booting Puma
=> Rails 6.1.5 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require': cannot load such file -- net/pop (LoadError)
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail/network/retriever_methods/pop3.rb:36:in `<class:POP3>'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail/network/retriever_methods/pop3.rb:35:in `<module:Mail>'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail/network/retriever_methods/pop3.rb:4:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:54:in `block in eager_autoload!'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:54:in `each'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:54:in `eager_autoload!'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer.rb:61:in `eager_load!'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application/finisher.rb:134:in `each'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application/finisher.rb:134:in `block in <module:Finisher>'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:32:in `run'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `call'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:60:in `run_initializers'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application.rb:391:in `initialize!'
	from /myapp/config/environment.rb:5:in `<main>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:37:in `start'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:144:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:135:in `perform'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/command/base.rb:69:in `perform'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/command.rb:48:in `invoke'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands.rb:18:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /myapp/bin/rails:5:in `<top (required)>'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in `load'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in `call'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/command.rb:7:in `call'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client.rb:30:in `run'
	from /usr/local/bundle/gems/spring-4.0.0/bin/spring:49:in `<top (required)>'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `load'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `<top (required)>'
	from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /myapp/bin/spring:10:in `block in <top (required)>'
	from <internal:kernel>:90:in `tap'
	from /myapp/bin/spring:7:in `<top (required)>'
	from bin/rails:2:in `load'
	from bin/rails:2:in `<main>'
# rails server
=> Booting Puma
=> Rails 6.1.5 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require': cannot load such file -- net/imap (LoadError)
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail/network/retriever_methods/imap.rb:40:in `<class:IMAP>'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail/network/retriever_methods/imap.rb:39:in `<module:Mail>'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail/network/retriever_methods/imap.rb:4:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:54:in `block in eager_autoload!'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:54:in `each'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:54:in `eager_autoload!'
	from /usr/local/bundle/gems/actionmailer-6.1.5/lib/action_mailer.rb:61:in `eager_load!'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application/finisher.rb:134:in `each'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application/finisher.rb:134:in `block in <module:Finisher>'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:32:in `run'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `call'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
	from /usr/local/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/initializable.rb:60:in `run_initializers'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/application.rb:391:in `initialize!'
	from /myapp/config/environment.rb:5:in `<main>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
	from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:37:in `start'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:144:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands/server/server_command.rb:135:in `perform'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/command/base.rb:69:in `perform'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/command.rb:48:in `invoke'
	from /usr/local/bundle/gems/railties-6.1.5/lib/rails/commands.rb:18:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /myapp/bin/rails:5:in `<top (required)>'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in `load'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in `call'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/command.rb:7:in `call'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client.rb:30:in `run'
	from /usr/local/bundle/gems/spring-4.0.0/bin/spring:49:in `<top (required)>'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `load'
	from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `<top (required)>'
	from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /myapp/bin/spring:10:in `block in <top (required)>'
	from <internal:kernel>:90:in `tap'
	from /myapp/bin/spring:7:in `<top (required)>'
	from bin/rails:2:in `load'
	from bin/rails:2:in `<main>'

@krhitoshi
Copy link
Author

krhitoshi commented Apr 13, 2022

I tried the branch 6-1-stable including the fix #44697.
I got an expected error like this.
It helps us understand what is wrong.
Thank you again!

# rails server
You don't have net-smtp installed in your application. Please add it to your Gemfile and run bundle install
=> Booting Puma
=> Rails 6.1.5 application starting in development
=> Run `bin/rails server --help` for more startup options
You don't have net-smtp installed in your application. Please add it to your Gemfile and run bundle install
Exiting
/usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require': cannot load such file -- net/smtp (LoadError)
	from /usr/local/bundle/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:9:in `<module:Mail>'
	from /usr/local/bundle/gems/mail-2.7.1/lib/mail.rb:3:in `<main>'

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