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

Deprecation warning with Rails 7.1 #425

Open
fragkakis opened this issue Apr 12, 2024 · 7 comments
Open

Deprecation warning with Rails 7.1 #425

fragkakis opened this issue Apr 12, 2024 · 7 comments

Comments

@fragkakis
Copy link

Hello, thank you for the library!

With rails 7.1 I get the following deprecation warning:

WarningHandlers::Rails::Deprecation: DEPRECATION WARNING: `clear_active_connections!` currently only applies to connection pools in the current role (`writing`). In Rails 7.2, this method will apply to all known pools, regardless of role. To affect only those connections belonging to a specific role, pass the role name as an argument. To switch to the new behavior, pass `:all` as the role name. (called from run_job_middleware at (eval):11)

The stack trace is the following:

  "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:187:in `clear_active_connections!'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.2/lib/active_record/connection_handling.rb:321:in `clear_active_connections!'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/active_record/connection.rb:45:in `call'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/utils/middleware.rb:36:in `invoke_middleware'",
      "(eval):11:in `run_job_middleware'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/worker.rb:103:in `work_job'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/worker.rb:76:in `work_loop'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/worker.rb:46:in `block in initialize'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'"

I noticed there are 2 occasions of clear_active_connections! called in que without an argument, so I guess both should be handled.

@fragkakis
Copy link
Author

Closing, noticed the relevant PR.

@fragkakis fragkakis reopened this Apr 26, 2024
@fragkakis
Copy link
Author

Reopening because the PR has not been merged.

@kaylareopelle
Copy link

Rails 7.2.0 was released on August 9, 2024, which dropped clear_active_connections!. This makes que incompatible with the latest version of Rails. Any update on when #423 might be merged?

@ZimbiX
Copy link
Member

ZimbiX commented Aug 12, 2024

Oh dear. I'll try to look into this tonight. In the meantime, if anyone could test out #423, I'd appreciate it

@kaylareopelle
Copy link

Hi, @ZimbiX! There's a small way I can test out #423.

I came across this issue due to test failures in opentelemetry-instrumentation-que gem.

When I run the tests for this gem with activerecord 7.2 and the branch for #423, the tests pass. Without it, they fail with the following message:

OpenTelemetry::Instrumentation::Que::processing a job that fails#test_0001_marks the span as failed:
NoMethodError: undefined method `clear_active_connections!' for ActiveRecord::Base:Class
    /bundle/ruby/3.2.0/gems/activerecord-7.2.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
    /bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/active_record/connection.rb:45:in `call'
    /bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/utils/middleware.rb:36:in `invoke_middleware'
    (eval):11:in `run_job_middleware'
    test/opentelemetry/instrumentation/que_test.rb:91:in `block (3 levels) in <top (required)>'

@kaylareopelle
Copy link

Hi @ZimbiX! Have you had a chance to take another look at this issue/#423?

@Tabby
Copy link

Tabby commented Oct 14, 2024

If it helps, I've tested #423 with some of our services and it fixes the deprecation warnings without causing any issues that I've been able to see. Is there anything else any of us can do to help get it merged? It is blocking us from upgrading to Rails 7.2

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

4 participants