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: Pipelining commands on a Redis instance is deprecated and will be removed in Redis 5.0.0 #193

Open
matthewhively opened this issue Mar 9, 2022 · 16 comments

Comments

@matthewhively
Copy link

Raised multiple times when performing Resque.enqueue by lib/redis/namespace.rb line 530 in version 1.8.2 of redis-namespace

I'm not sure whether this is an issue with the redis-namespace, or with the way that Resque itself is passing commands to the namespace.

@danlo
Copy link
Contributor

danlo commented Mar 13, 2022

Looks like this belongs to the resque gem: https://github.com/resque/resque/blob/master/lib/resque/data_store.rb#L103

@danlo
Copy link
Contributor

danlo commented Mar 13, 2022

@danlo
Copy link
Contributor

danlo commented Mar 13, 2022

I looked though the redis-namespace code and found the following which may be of interest:

https://github.com/resque/redis-namespace/blob/master/lib/redis/namespace.rb#L529

    def namespaced_block(command, &block)
      if block.arity == 0
        redis.send(command, &block)
      else
        redis.send(command) do |r|
          copy = dup

Reading the redis documentation, I believe that an argument is always meant to always be passed.

https://github.com/redis/redis-rb#pipelining

Thus, block.arity == 0 should never happen?

-daniel

@ericboehs
Copy link

You're right, block.arity ==0 should never happen, but it is because whatever is calling your Redis connection is passing a block without an arg. The issue isn't with this gem (afaict), but with your app code.

Unfortunately the deprecation doesn't give a stack trace (even with ActiveSupport::Deprecation.debug = true set). In order to debug this, I edited the gem (bundle open redis-namespace) and threw a puts command, block in the arity == 0 if block (line 530).

This showed me the actual location of the bad code (e.g. calling .multi without an arg).

Removing the arity == 0 check here will just cause errors or push the deprecation to another line.

@mihael
Copy link

mihael commented Apr 22, 2022

Am using redis with resque, and here's the problematic code:

https://github.com/resque/resque/blob/master/lib/resque/data_store.rb#L102-L106

Screenshot 2022-04-22 at 11 53 25

@virgoproz
Copy link

Correct, data_store.rb in the current version of the Resque gem needs to be refactored to remove the deprecated use of .pipelined (without args)! Should be a no-brainer

@mishina2228
Copy link

Am using redis with resque, and here's the problematic code:

https://github.com/resque/resque/blob/master/lib/resque/data_store.rb#L102-L106

Now this part has been fixed in resque/resque#1806.
https://github.com/resque/resque/blob/ba5a44294ba5f6c4593deb78612f78989445d83e/lib/resque/data_store.rb#L102-L107

New version of resque has not yet been released though.

@kyrylo
Copy link

kyrylo commented Aug 9, 2022

Can we push a new release, please? This warning is a little bit annoying since, in my case, it's being run almost after every single test that I have.

@nvolker
Copy link

nvolker commented Aug 11, 2022

Would be great to push this fix out. Appreciate the efforts here!

@kyrylo
Copy link

kyrylo commented Aug 15, 2022

I can see v1.9.0 was pushed on August 13, 2022 but this warning has not been fixed for me.

Pipelining commands on a Redis instance is deprecated and will be removed in Redis 5.0.0.

redis.pipelined do
  redis.get("key")
end

should be replaced by

redis.pipelined do |pipeline|
  pipeline.get("key")
end

(called from /Users/kyrylosilin/.gem/ruby/2.7.6/gems/redis-namespace-1.9.0/lib/redis/namespace.rb:533:in `namespaced_block'}

@matthewhively
Copy link
Author

Should be fixed by Resque 2.3.0
Not quite out yet.

@matthewhively
Copy link
Author

Looks like not everything is fixed by resque 2.3.0
Still receiving these even after upgrading to Resque 2.3.0 & redis-namespace 1.9.0

@matthewhively
Copy link
Author

matthewhively commented Aug 22, 2022

I also see this warning raised now too:
Redis#sadd will always return an Integer in Redis 5.0.0. Use Redis#sadd? instead.(called from: ~/.rvm/gems/ruby-2.5.7/gems/redis-namespace-1.9.0/lib/redis/namespace.rb:479:in 'call_with_namespace')

# Dispatch the command to Redis and store the result.
result = @redis.send(command, *args, &block)

@william-eth
Copy link

Maybe adding the config at the file /config/initializers/redis.rb can ignore the warning, just silence, not fix it.

Redis.silence_deprecations = true

@oscaredel
Copy link

I also see this warning raised now too: Redis#sadd will always return an Integer in Redis 5.0.0. Use Redis#sadd? instead.(called from: ~/.rvm/gems/ruby-2.5.7/gems/redis-namespace-1.9.0/lib/redis/namespace.rb:479:in 'call_with_namespace')

I've created a PR for this one: #207

@gregblass
Copy link

gregblass commented Aug 25, 2022

@william-eth - That worked for me for the time being to silence the depreciation (like others said it was flooding my console)

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