redis-store: `get` fails on Redis::Future

We’re using redis-store for our connections, and keep getting the following error:

/.rvm/gems/ruby-2.3.1/gems/redis-store-1.3.0/lib/redis/store/marshalling.rb:43:in `_unmarshal'
/.rvm/gems/ruby-2.3.1/gems/redis-store-1.3.0/lib/redis/store/marshalling.rb:17:in `get'
/.rvm/gems/ruby-2.3.1/gems/redis-store-1.3.0/lib/redis/store/namespace.rb:23:in `block in get'
/.rvm/gems/ruby-2.3.1/gems/redis-store-1.3.0/lib/redis/store/namespace.rb:84:in `namespace'
/.rvm/gems/ruby-2.3.1/gems/redis-store-1.3.0/lib/redis/store/namespace.rb:23:in `get'

I’ve dug into it, and the get is returning a Redis::Future object, which has no size method and causes the unmarshal? to fail.

There was a similar issue in the redis-activesupport repo, but they resolved it by moving code about, rather than what appears to be the underlying issue. (Issue here and PR here)

Any help/resolution w/ this would be greatly appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Problem is caused by Sikdekiq Web UI fetching keys that do not existing in Redis using pipeline. The error can be reproduced with:

ruby -rredis-store -e 'Redis::Store.new.pipelined { |conn | conn.get(%q(lol)) }'

I believe if you are using Sidekiq UI then you can turned off marshalling, because data are stored as JSON in Redis. You can can turn off marshalling using marshalling: false.