Closed yart closed 10 months ago
[2] pry(main)> r.ping
Redis::CommandError: ERR value is not an integer or out of range
from /usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client/connection_mixin.rb:61:in `call_pipelined'
Caused by RedisClient::CommandError: ERR value is not an integer or out of range
from /usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client/connection_mixin.rb:61:in `call_pipelined'
Could you provide the full backtrace here?
>> error = (r.ping rescue $!)
>> puts error.backtrace
For some reason r.ping
end up calling a pipeline which makes little sense I suspect you have some monkey patch of some sort in your app or one of you dependencies.
@byroot, please loot at this:
[1] pry(main)> r = REDIS
=> #<Redis client v5.0.8 for redis://run_redis_dev:6379/robotix_max_bot>
[2] pry(main)> error = (r.ping rescue $!)
=> #<Redis::CommandError: ERR value is not an integer or out of range>
[3] pry(main)> puts error.backtrace
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client/connection_mixin.rb:61:in `call_pipelined'
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client.rb:745:in `block in connect'
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client/middlewares.rb:16:in `call'
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client.rb:744:in `connect'
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client.rb:706:in `raw_connection'
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client.rb:673:in `ensure_connected'
/usr/local/bundle/gems/redis-client-0.18.0/lib/redis_client.rb:269:in `call_v'
/usr/local/bundle/gems/redis-5.0.8/lib/redis/client.rb:90:in `call_v'
/usr/local/bundle/gems/redis-5.0.8/lib/redis.rb:152:in `block in send_command'
/usr/local/bundle/gems/redis-5.0.8/lib/redis.rb:151:in `synchronize'
/usr/local/bundle/gems/redis-5.0.8/lib/redis.rb:151:in `send_command'
/usr/local/bundle/gems/redis-5.0.8/lib/redis/commands/connection.rb:21:in `ping'
(pry):2:in `__pry__'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:290:in `eval'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:290:in `evaluate_ruby'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:659:in `handle_line'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:261:in `block (2 levels) in eval'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:260:in `catch'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:260:in `block in eval'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:259:in `catch'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_instance.rb:259:in `eval'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/repl.rb:77:in `block in repl'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/repl.rb:67:in `loop'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/repl.rb:67:in `repl'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/repl.rb:38:in `block in start'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/input_lock.rb:61:in `__with_ownership'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/input_lock.rb:78:in `with_ownership'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/repl.rb:38:in `start'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/repl.rb:15:in `start'
/usr/local/bundle/gems/pry-byebug-3.10.1/lib/pry-byebug/pry_ext.rb:15:in `start_with_pry_byebug'
/usr/local/bundle/gems/pry-0.14.2/lib/pry/pry_class.rb:194:in `start'
/usr/local/bundle/gems/railties-7.0.8/lib/rails/commands/console/console_command.rb:74:in `start'
/usr/local/bundle/gems/railties-7.0.8/lib/rails/commands/console/console_command.rb:19:in `start'
/usr/local/bundle/gems/railties-7.0.8/lib/rails/commands/console/console_command.rb:106:in `perform'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/usr/local/bundle/gems/railties-7.0.8/lib/rails/command/base.rb:87:in `perform'
/usr/local/bundle/gems/railties-7.0.8/lib/rails/command.rb:48:in `invoke'
/usr/local/bundle/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
bin/rails:4:in `<main>'
=> nil
Ok, it fails as part of the connection prelude and based on the error message I would hasard the guess that you are passing a db:
parameter that isn't an Integer.
It's actually visible in what you posted initially: redis://run_redis_dev:6379/robotix_max_bot
here robotix_max_bot
is treaded as the DB index, and can't be converted to integer. Just remove that part of the URL, or explictly pass a db: 0
parameter to overwrite it.
That said, redis-client
should fail sooner with a cleaner error when this mistake is made, so I'll keep the issue open until I improve that.
explictly pass a
db: 0
parameter to overwrite it.
OMG! :man_facepalming: My mistake. Thanks for the explanation and fix.
My case:
Redis runs in a Docker container with the same network as my app's container.
Then I'm running
rails c
:Why is this happening? The first call provides the error, and then it goes smoothly always 'till restart the app.
Of course, I can catch this Exception, but in my opinion, this isn't the best practice in this case. Can anybody tell me what am I doing wrong?
My Gemfile: