Comments (12)
Also experiencing this. Works as expected in dev but throws the uninitialized constant SolidQueue
error in production env.
from solid_queue.
Hey @djmb
In my gem file I have
# background jobs backend
gem 'solid_queue', '~> 0.1.1'
I've added require: true
to the gemfile and the same behavior continues
If I do rails s
in my development machine, it works as expected (meaning, solid queue runs). However, if I run with bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
it crashes with the error.
# frozen_string_literal: true
source 'https://rubygems.org'
ruby '3.2.2'
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 7.1.2'
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'
# Use the Puma web server [https://github.com/puma/puma]
gem 'puma', '>= 5.0'
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem 'importmap-rails'
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem 'turbo-rails'
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem 'stimulus-rails'
# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
gem 'tailwindcss-rails'
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem 'jbuilder'
# Use Redis adapter to run Action Cable in production
gem 'redis', '>= 4.0.1'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[jruby]
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false
group :development, :test do
gem 'brakeman'
gem 'bundler-audit'
gem 'debug', platforms: %i[mri]
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rails'
end
group :development do
gem 'web-console'
gem 'rack-mini-profiler'
gem 'derailed_benchmarks'
gem 'memory_profiler'
gem 'stackprof'
end
group :test do
gem 'capybara'
gem 'selenium-webdriver'
end
# authentication
gem 'rodauth-rails', '~> 1.12'
# background jobs backend
gem 'solid_queue', '~> 0.1.1', require: true
# multitenancy
gem 'acts_as_tenant'
gem 'matrix', '~> 0.4.2'
# apm
gem 'appsignal'
# email provider
gem 'postmark-rails'
from solid_queue.
Thanks @raphaeljlps - I can see that failing as well now.
Loading the application first in config/puma.rb
looks like it fixes it:
# config/puma.rb
require File.expand_path("environment", File.dirname(__FILE__))
...
But that's not ideal. We'd maybe will want to shell out to the solid queue rake task or exe (once we add one) instead.
from solid_queue.
Same issue here, on Heroku. Why was this closed with no solutions?
from solid_queue.
@atstockland there was a solution, we have @djmb workaround and I see a PR by @nashby.
Are you still affected by this? I'm using the latests version on Render without issues and without the workaround.
from solid_queue.
Hey
the problem is still here (on devlopement & production mode).
The gem seems to be loaded but not all these modules.
do you have any idea how to load all the modules?
# Procfile
puma: bundle exec puma -C config/puma/development.rb
# config/puma/development.rb
bind "ssl://0.0.0.0:4000"
workers 2
threads 1, 3
plugin :solid_queue
# solid_queue/lib/puma/plugin/solid_queue.rb
def start(launcher)
@log_writer = launcher.log_writer
@puma_pid = $$
launcher.events.on_booted do
puts "puma is booted..."
puts defined?(SolidQueue) ? "SolidQueue loaded" : "SolidQueue Not loaded"
puts defined?(SolidQueue::VERSION) ? "SolidQueue Version: #{SolidQueue::VERSION}" : "SolidQueue: Not loaded"
puts defined?(SolidQueue::Supervisor) ? "SolidQueue::Supervisor loaded" : "SolidQueue::Supervisor: Not loaded"
@solid_queue_pid = fork do
Thread.new { monitor_puma }
SolidQueue::Supervisor.start(mode: :all)
end
in_background do
monitor_solid_queue
end
end
launcher.events.on_stopped { stop_solid_queue }
launcher.events.on_restart { stop_solid_queue }
end
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: Puma starting in cluster mode...
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Puma version: 6.4.2 (ruby 3.2.2-p53) ("The Eagle of Durango")
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Min threads: 1
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Max threads: 3
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Environment: development
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Master PID: 97629
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Workers: 2
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Restarts: (✔) hot (✔) phased
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: * Listening on ssl://0.0.0.0:4000
01:45:06 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:06 -0500: Use Ctrl-C to stop
01:45:07 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:07 -0500: - Worker 1 (PID: 97636) booted in 1.13s, phase: 0
01:45:07 puma.1 | [97629] [MacBook-Pro.local] 2024-04-17 01:45:07 -0500: - Worker 0 (PID: 97635) booted in 1.13s, phase: 0
01:45:07 puma.1 | puma is booted...
01:45:07 puma.1 | SolidQueue loaded
01:45:07 puma.1 | SolidQueue Version: 0.3.0
01:45:07 puma.1 | SolidQueue::Supervisor: Not loaded
01:45:07 puma.1 | /Users/test/solid_queue/lib/puma/plugin/solid_queue.rb:18:in `block (2 levels) in start': uninitialized constant SolidQueue::Supervisor (NameError)
01:45:07 puma.1 |
01:45:07 puma.1 | SolidQueue::Supervisor.start(mode: :all)
01:45:07 puma.1 | ^^^^^^^^^^^^
01:45:07 puma.1 | from /Users/test/solid_queue/lib/puma/plugin/solid_queue.rb:16:in `fork'
from solid_queue.
In case anyone still has this problem after the #86, here's what helped me:
For me, I got the same error as @jules-w2, but only when puma was running in a cluster mode. Error went away once I added preload_app!
to puma.rb
config (note that this disables phased restarts)
from solid_queue.
Hi @raphaeljlps,
I've tested this out on a fresh Rails app and it works fine when I have gem "solid_queue"
in the gemfile. If however I do gem "solid_queue", require: false
I get the same error as you have. Is that what you have in your setup?
If that's the issue here, adding require "solid_queue"
to the plugin won't help as by the time its invoked we are too far on in the Rails initialisation process. You'll need to require the gem from the Gemfile instead.
If that's not what's going on here, do you have anything else you could share about your setup?
from solid_queue.
same issue here : fine with rails s
but same exception with below
bundle exec puma -C config/puma.rb --early-hints -e development
from solid_queue.
Sorry about that--I didn't realize that was the sanctioned work-around. I did try that, but the issue persisted for me. I'll try again, or try after the next update. Thanks so much!
from solid_queue.
I must have had a compounding problems going on the first time I tried. I just updated my puma.rb to load the environment and everything works fine now.
Thanks!
from solid_queue.
In my case i'm using cluster mode and phased restarts for Puma.
I was never able to get the plugin to work in development or production modes.
So I wrote a gem to manage Capistrano tasks. It manages SolidQueue as a service in production mode and in development I launch it in Procfile
https://github.com/IMMOSQUARE/immosquare-capistrano?tab=readme-ov-file#solidqueue-integration
[Unit]
Description=SolidQueue for <%= "#{fetch(:application)} (#{fetch(:stage)})" %>
After=syslog.target network.target
[Service]
Type=simple
Environment=RAILS_ENV=<%= fetch(:stage) %>
User=<%= fetch(:solid_queue_user) %>
WorkingDirectory=<%= current_path %>
ExecStart=<%= Capistrano::Immosquare::Helpers.expanded_bundle_command %> exec rake solid_queue:start
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -TERM $MAINPID
StandardOutput=append:<%= shared_path %>/log/solid_queue_access.log
StandardError=append:<%= shared_path %>/log/solid_queue_error.log
RestartSec=1
Restart=on-failure
SyslogIdentifier=<%= fetch(:solid_queue_service_unit_name) %>
[Install]
WantedBy=default.target
from solid_queue.
Related Issues (20)
- Puma plugin causes warning about unresolved or ambiguous Gem specs HOT 1
- Store actual exception instead of full `retry_on` condition HOT 2
- Cron tasks can give weird errors if enqueue fails HOT 5
- Solid Queue isn't processing jobs in queues HOT 2
- Deleting scheduled jobs HOT 1
- Database pool size in multi workers setup HOT 2
- Stopping in progress job HOT 3
- Not Finding Recurring Jobs HOT 3
- Best way to delete an old queue HOT 2
- Feature Request: Automatic Worker Process Recycling HOT 6
- urls for corresponding classes? HOT 4
- `PG::ConnectionBad` error when restarting container running `solid_queue:start` HOT 15
- SolidQueue trying to interact with db2 database connection and failing to insert job records HOT 8
- NoMethodError from application.active_support #3 undefined method `unblock_next_blocked_job' for nil HOT 13
- Persistent "Key (job_id) already exists" error when claiming jobs HOT 6
- DB connection pool size HOT 2
- Wrong upgrade url HOT 2
- On 0.4 Errno::ECHILD errors are popping up HOT 9
- Execute polling queries to ReadReplica HOT 2
- NameError uninitialized constant X, but works several minutes later on retry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid_queue.