我们正在使用Redis将会话存储在Rails 5.2中,最近我们切换了Redis托管,并开始看到一些会话的一些奇怪错误,但不是全部:
puma 002 debug_exceptions.rb:9 exception=[ArgumentError: dump format error(0x37): /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2.1/lib/active_suppo
rt/core_ext/marshal.rb:6:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2.1/lib/active_support/core_ext/marshal.rb:6:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/redis-store-1.5.0/lib/redis/store/serialization.rb:44:in `_unmarshal'
/app/vendor/bundle/ruby/2.5.0/gems/redis-store-1.5.0/lib/redis/store/serialization.rb:17:in `get'
/app/vendor/bundle/ruby/2.5.0/gems/redis-store-1.5.0/lib/redis/store/namespace.rb:23:in `block in get'
/app/vendor/bundle/ruby/2.5.0/gems/redis-store-1.5.0/lib/redis/store/namespace.rb:89:in `namespace'
/app/vendor/bundle/ruby/2.5.0/gems/redis-store-1.5.0/lib/redis/store/namespace.rb:23:in `get'
/app/vendor/bundle/ruby/2.5.0/gems/redis-rack-2.0.4/lib/rack/session/redis.rb:50:in `block (2 levels) in get_session'
/app/vendor/bundle/ruby/2.5.0/gems/redis-rack-2.0.4/lib/rack/session/redis.rb:94:in `with'
/app/vendor/bundle/ruby/2.5.0/gems/redis-rack-2.0.4/lib/rack/session/redis.rb:50:in `block in get_session'
/app/vendor/bundle/ruby/2.5.0/gems/redis-rack-2.0.4/lib/rack/session/redis.rb:79:in `with_lock'
/app/vendor/bundle/ruby/2.5.0/gems/redis-rack-2.0.4/lib/rack/session/redis.rb:49:in `get_session'
/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:425:in `find_session'
/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:280:in `load_session'
/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/session/abstract_store.rb:46:in `block in load_session'
/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/session/abstract_store.rb:54:in `stale_session_check!'
/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/session/abstract_store.rb:46:in `load_session'
/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2.1/lib/action_dispatch/request/session.rb:221:in `load!'
/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2.1/lib/action_dispatch/request/session.rb:217:in `load_for_write!'
/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2.1/lib/action_dispatch/request/session.rb:118:in `[]='
...
当我们检查会话并尝试对数据手动使用Marshal.load
时,会遇到相同的错误。
我们有几个与此有关的问题:
Marshal.load
获取更准确的信息还是更精确地调试(反)序列化?