rails / solid_queue

Database-backed Active Job backend
MIT License
1.66k stars 90 forks source link

Puma plugin causes warning about unresolved or ambiguous Gem specs #243

Open MrSerth opened 1 month ago

MrSerth commented 1 month ago

When working with the puma plugin, another issue could occur. Potentially, this issue is resolved together with #241. The issue is that pruning the bundler environment together with a on_restart directive causes issues with Gem::Specification.reset:

=> Booting Puma
=> Rails 7.1.3.4 application starting in development 
=> Run `bin/rails server --help` for more startup options
[69212] * Pruning Bundler environment
[69212] Puma starting in cluster mode...
[69212] * Puma version: 6.4.2 (ruby 3.3.2-p78) ("The Eagle of Durango")
[69212] *  Min threads: 5
[69212] *  Max threads: 5
[69212] *  Environment: development
[69212] *   Master PID: 69212
[69212] *      Workers: 10
[69212] *     Restarts: (✔) hot (✔) phased
[69212] * Listening on http://0.0.0.0:3000
[69212] Use Ctrl-C to stop
[69212] + Gemfile in context: /solid_queue/Gemfile
WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      drb (>= 0)
      Available/installed versions of this gem:
      - 2.2.1
      - 2.2.0
      bigdecimal (>= 0)
      Available/installed versions of this gem:
      - 3.1.8
      - 3.1.5
      irb (>= 0)
      Available/installed versions of this gem:
      - 1.13.1
      - 1.11.0
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
[69212] - Worker 0 (PID: 69215) booted in 1.0s, phase: 0

I tested multiple combinations, but adding Solid Queue together with the puma plugin and configuring on_restart was the only combination this error occurred. As soon as either the gem or the on_restart is removed, no warning is issued.

Steps to reproduce:

  1. Create a new Rails app: rails new "solid_queue" -T --api --no-tests
  2. Add the gem to the Gemfile gem "solid_queue"
  3. Run bundle install
  4. Install with rails generate solid_queue:install
  5. Migrate with rails db:migrate
  6. Modify the puma.rb config: a. Configure workers to be used, i.e. workers 2 b. Add prune_bundler c. Add an (empty) block for restarts: on_restart {}
  7. Start the app regularly through rails s
  8. ⚡️ See the above warning.

Ruby: 3.3.2 +YJIT Rails: 7.1.3.4 Puma: 6.4.2 Solid Queue: 0.3.3