solid_queue
solid_queue copied to clipboard
Puma plugin fails with `NameError`
We've just integrated solid_queue
in our Rails app and want to use the puma plugin to run Solid Queue's supervisor. However, with our current puma config, this fails:
/.rvm/gems/ruby-3.3.2/gems/solid_queue-0.3.3/lib/puma/plugin/solid_queue.rb:13:in `block (2 levels) in start': uninitialized constant SolidQueue (NameError)
SolidQueue::Supervisor.start(mode: :all)
^^^^^^^^^^
from /.rvm/gems/ruby-3.3.2/gems/solid_queue-0.3.3/lib/puma/plugin/solid_queue.rb:11:in `fork'
from /.rvm/gems/ruby-3.3.2/gems/solid_queue-0.3.3/lib/puma/plugin/solid_queue.rb:11:in `block in start'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/events.rb:17:in `block in fire'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/events.rb:17:in `each'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/events.rb:17:in `fire'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/events.rb:46:in `fire_on_booted!'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/cluster.rb:495:in `run'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/launcher.rb:194:in `run'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/lib/puma/cli.rb:75:in `run'
from /.rvm/gems/ruby-3.3.2/gems/puma-6.4.2/bin/puma:10:in `<top (required)>'
from /.rvm/gems/ruby-3.3.2/bin/puma:25:in `load'
from /.rvm/gems/ruby-3.3.2/bin/puma:25:in `<main>'
from /.rvm/gems/ruby-3.3.2/bin/ruby_executable_hooks:22:in `eval'
from /.rvm/gems/ruby-3.3.2/bin/ruby_executable_hooks:22:in `<main>'
[95129] ! reaped unknown child process pid=95143 status=pid 95143 exit 1
I've reduced our puma.rb
config and also reproduced the issue with a new Rails app.
Steps to reproduce:
- Create a new Rails app:
rails new "solid_queue" -T --api --no-tests
- Add the gem to the Gemfile
gem "solid_queue"
- Run
bundle install
- Install with
rails generate solid_queue:install
- Migrate with
rails db:migrate
- Modify the
puma.rb
config: a. Configureworkers
to be used, i.e.workers 2
b. Addpreload_app! false
c. Add the puma plugin withplugin :solid_queue
- Start the app through Puma with
bundle exec puma
- ⚡️ See the above name error.
Even without starting the app through puma
, I was able to reproduce the error with the following steps:
Steps to reproduce:
- Create a new Rails app:
rails new "solid_queue" -T --api --no-tests
- Add the gem to the Gemfile
gem "solid_queue"
- Run
bundle install
- Install with
rails generate solid_queue:install
- Migrate with
rails db:migrate
- Modify the
puma.rb
config: a. Configureworkers
to be used, i.e.workers 2
b. Addprune_bundler
c. Add the puma plugin withplugin :solid_queue
- Start the app regularly through
rails s
- ⚡️ See the above name error.
In our production environment, we use a combination of the puma
command with preload_app! false
("replaced" by fork_worker
) and prune_bundler
for phased restarts. Obviously, this configuration isn't supported by the puma plugin.
Ruby: 3.3.2 +YJIT Rails: 7.1.3.4 Puma: 6.4.2 Solid Queue: 0.3.3