Describe the bug
Since updating puma app from 4.1.1 to 4.2.0, my rails app doesn't start.
Puma config:
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
Error message
Please, check the "Autoloading and Reloading Constants" guide for solutions.
(called from <top (required)> at /usr/src/app/config/environment.rb:5)
* Listening on ssl://0.0.0.0:3000?key=config/localhost.key&cert=config/localhost.crt
bundler: failed to load command: puma (/usr/local/bundle/bin/puma)
NoMethodError: undefined method `local_address' for #<Puma::MiniSSL::Server:0x000055903b829710>
/usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:108:in `block (2 levels) in parse'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:107:in `each'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:107:in `block in parse'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:89:in `each'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:89:in `parse'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/runner.rb:154:in `load_and_bind'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/single.rb:98:in `run'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/launcher.rb:172:in `run'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/cli.rb:80:in `run'
/usr/local/bundle/gems/puma-4.2.0/bin/puma:10:in `<top (required)>'
/usr/local/bundle/bin/puma:23:in `load'
/usr/local/bundle/bin/puma:23:in `<top (required)>'
What command do you use to start Puma? Nothing in your config indicates that you're using SSL.
Sorry, I should have included it. The command I'm using to start Rails (for development, which is where the issue is) is:
bundle exec puma -b 'ssl://0.0.0.0:3000?key=config/localhost.key&cert=config/localhost.crt' -b 'tcp://0.0.0.0:3001'
If there's a better puma config I can use instead, I'd welcome the change, because I'd rather than rails via rails s (for various unrelated reasons).
Thanks. This is a duplicate of #1986, just a slightly different failure mode. We'll get it fixed in #1989 with a 4.2.1 release v v soon.
To set your binds in puma.rb instead, check out lib/dsl.rb to see how to do it.