ArgumentError (dump format error)
和往常一样,我先检查了我的另一个脑子.最热门的搜索结果是:https://github.com/rails/rails/issues/2509
虽然启动该线程的用户和其他几个海报尝试从Rails 3.0.9升级到Rails 3.1,但我认为它不适用于我的情况.我正在运行的Spree 0.60.2应用程序是在Rails 3.0.9.
然而,事实证明,只需清除我的localhost cookie即可解决问题.为什么?
解决方法
I traced this error and it happens because the FlashHash class in the
session has been changed to no longer inherit from the Hash class in
rails 3.1.
我做了一个实验.如果我没有登录任何一个版本的应用程序,我可以启动一个并关闭它并启动另一个并且不会遇到这个问题.但是,当我登录到3.0.9版本然后关闭该服务器并启动3.1版本时,我再次收到相同的错误.这是部分跟踪:
activesupport (3.1.1) lib/active_support/message_verifier.rb:34:in
load' activesupport (3.1.1)
verify’ actionpack
lib/active_support/message_verifier.rb:34:in
(3.1.1) lib/action_dispatch/middleware/cookies.rb:280:in[]'
block in
actionpack (3.1.1)
lib/action_dispatch/middleware/session/cookie_store.rb:53:in
unpacked_cookie_data’ actionpack (3.1.1)
lib/action_dispatch/middleware/session/abstract_store.rb:55:in
stale_session_check!' actionpack (3.1.1)
unpacked_cookie_data’ rack (1.3.6) lib/rack/session/cookie.rb:96:in
lib/action_dispatch/middleware/session/cookie_store.rb:51:in
extract_session_id' actionpack (3.1.1)
block
lib/action_dispatch/middleware/session/abstract_store.rb:51:in
in extract_session_id’ actionpack (3.1.1)
lib/action_dispatch/middleware/session/abstract_store.rb:55:in
stale_session_check!' actionpack (3.1.1)
extract_session_id’ rack (1.3.6)
lib/action_dispatch/middleware/session/abstract_store.rb:51:in
lib/rack/session/abstract/id.rb:43:inload_session_id!' rack (1.3.6)
[]’ rack (1.3.6)
lib/rack/session/abstract/id.rb:32:in
lib/rack/session/abstract/id.rb:252:incurrent_session_id' rack
session_exists?’ rack
(1.3.6) lib/rack/session/abstract/id.rb:258:in
(1.3.6) lib/rack/session/abstract/id.rb:104:inexists?' rack (1.3.6)
load_for_read!’ rack (1.3.6)
lib/rack/session/abstract/id.rb:114:in
lib/rack/session/abstract/id.rb:64:inhas_key?' actionpack (3.1.1)
ensure in call’
lib/action_dispatch/middleware/flash.rb:260:in
actionpack (3.1.1) lib/action_dispatch/middleware/flash.rb:261:in
call' rack (1.3.6) lib/rack/session/abstract/id.rb:195:in
context’
rack (1.3.6) lib/rack/session/abstract/id.rb:190:in `call’
反过来也是如此.当我登录3.1版本然后关闭该服务器并启动3.0.9版本时,我收到了同样的错误.这是部分跟踪:
activesupport (3.0.9) lib/active_support/message_verifier.rb:34:in
load' activesupport (3.0.9)
verify’ actionpack
lib/active_support/message_verifier.rb:34:in
(3.0.9) lib/action_dispatch/middleware/cookies.rb:253:in[]'
block in
actionpack (3.0.9)
lib/action_dispatch/middleware/session/cookie_store.rb:68:in
unpacked_cookie_data’ actionpack (3.0.9)
lib/action_dispatch/middleware/session/abstract_store.rb:223:in
stale_session_check!' actionpack (3.0.9)
unpacked_cookie_data’ actionpack (3.0.9)
lib/action_dispatch/middleware/session/cookie_store.rb:66:in
lib/action_dispatch/middleware/session/cookie_store.rb:57:in
extract_session_id' actionpack (3.0.9)
load_session_id!’ actionpack (3.0.9)
lib/action_dispatch/middleware/session/abstract_store.rb:39:in
lib/action_dispatch/middleware/session/abstract_store.rb:27:in[]'
current_session_id’ actionpack (3.0.9)
actionpack (3.0.9)
lib/action_dispatch/middleware/session/abstract_store.rb:210:in
lib/action_dispatch/middleware/session/abstract_store.rb:239:in
exists?' actionpack (3.0.9)
exists?’ actionpack (3.0.9)
lib/action_dispatch/middleware/session/abstract_store.rb:96:in
lib/action_dispatch/middleware/session/abstract_store.rb:113:in
load_for_read!' actionpack (3.0.9)
[]’
lib/action_dispatch/middleware/session/abstract_store.rb:53:in
actionpack (3.0.9) lib/action_dispatch/middleware/flash.rb:178:in
call' actionpack (3.0.9)
call’
lib/action_dispatch/middleware/session/abstract_store.rb:149:in
对我来说值得注意的是,你不需要真正地进行升级.要重现此问题,您只需要运行两个版本的Rails,这两个版本的Rails设置具有相同名称的Cookie …可能是按顺序(如在我的实验中)或同时(我没有尝试过).
希望这里的其他人能提供比这更好的答案,以添加这个松散的解释所缺乏的细节.与此同时,如果你在开发过程中遇到这个问题并且你不关心内部工作,只需清除你的cookie(如上面引用的线程中的@tscolari所建议的那样:https://github.com/rails/rails/issues/2509)并继续前进.干杯.