Redis调用

时间:2015-05-20 19:24:31

标签: ruby redis

我随机收到以下错误消息。有没有人有任何想法可能导致这个?

NoMethodError (undefined method `slice!' for nil:NilClass):
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:274:in `read'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:248:in `block in read'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:236:in `io'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:247:in `read'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `block in call'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:217:in `block (2 levels) in process'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:353:in `ensure_connected'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:207:in `block in process'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:292:in `logging'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:206:in `process'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `call'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:789:in `block in get'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:37:in `block in synchronize'
 /usr/local/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:37:in `synchronize'
 vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:788:in `get'
 vendor/bundle/ruby/2.1.0/gems/redis-store-1.1.4/lib/redis/store/interface.rb:5:in `get'
 vendor/bundle/ruby/2.1.0/gems/redis-store-1.1.4/lib/redis/store/marshalling.rb:17:in `get'
 vendor/bundle/ruby/2.1.0/gems/redis-activesupport-4.0.0/lib/active_support/cache/redis_store.rb:169:in `read_entry'
 vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:312:in `block in read'
 vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:548:in `instrument'
 vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:311:in `read'
 /var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/store.rb:34:in `get'
 /var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/scoped_store.rb:13:in `fetch'
 /var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/preferable_class_methods.rb:13:in `block in preference'
 /var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/preferable.rb:43:in `get_preference'
 vendor/bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/lib/spree/core/controller_helpers/ssl.rb:8:in `block (2 levels) in <module:SSL>'

last place狂欢在调用redis-rb之前被击中:

  unless (val = @cache.read(key)).nil? 
     return val 
   end 

其中@cache = Rails.cache

更新

我正在使用此SSL plugin的gem,因此错误可能与插件有关。

line = @sock.getsnil时发生错误。这是当地人之后确定的真实。

[1] pry(#<Redis::Connection::Ruby>)> line
=> nil
[2] pry(#<Redis::Connection::Ruby>)> @sock
=> #<OpenSSL::SSL::SSLSocket:0x007fdab2688730
 @callback_state=nil,
 @context=
  #<OpenSSL::SSL::SSLContext:0x007fdab2688758
   @ca_file=nil,
   @ca_path=nil,
   @cert=nil,
   @cert_store=nil,
   @client_ca=nil,
   @client_cert_cb=nil,
   @extra_chain_cert=nil,
   @key=nil,
   @npn_protocols=nil,
   @npn_select_cb=nil,
   @options=nil,
   @renegotiation_cb=nil,
   @servername_cb=nil,
   @session_get_cb=nil,
   @session_id_context=nil,
   @session_new_cb=nil,
   @session_remove_cb=nil,
   @timeout=nil,
   @tmp_dh_callback=nil,
   @verify_callback=nil,
   @verify_depth=nil,
   @verify_mode=nil>,
 @eof=true,
 @hostname=nil,
 @io=#<Redis::Connection::TCPSocket:fd 11>,
 @rbuffer="",
 @sync=true,
 @sync_close=false,
 @wbuffer="">
[3] pry(#<Redis::Connection::Ruby>)> @sock.closed?
=> false

1 个答案:

答案 0 :(得分:0)

这看起来可能是ruby redis客户端的一个问题。

您可以尝试降级版本和/或为redis团队in the Github repository提交问题。