Rails CookieStore::CookieOverflow,不适合所有用户,仅在生产中
我有几个用户收到此 CookieStore::CookieOverflow 错误。
我对 nginx/passenger 表示怀疑,因为我上周刚刚切换到 nginx/passenger(从 nginx/thin),现在这些正在发生。
这始终是一个特定的操作,但并不是所有用户都会发生。我检查了会话中存储的内容,但没有保存任何大型对象,只保存了几个 id 和几个布尔值。
如果我在会话中存储大对象,我希望所有用户都会遇到此错误。
有关如何解决此问题的建议会很有帮助。
I have a couple users that are getting this CookieStore::CookieOverflow error.
I'm suspicious of nginx/passenger because I just switched to that last week (from nginx/thin) and now these are happening.
It's always a particular action, but it doesn't happen for all users. I checked to see what I'm storing in the session and I'm not saving any large objects, just a couple ids and a couple boolean values.
If I were storing big objects in the session, I'd expect all users to have this error.
Suggestions on how to troubleshoot this would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
跟踪和调试 CookieStore::CookieOverflow 错误并不简单。您应该尝试在网站上复制完全相同的用户活动。
修复该错误的一些建议:
* 切换到更具可扩展性的cookie存储,例如ActiveRecord或Memcached
* 尝试减少会话中存储的元素数量
另请注意,Flash 消息存储在会话中。如果您发回非常长的 Flash 消息文本,您可能会遇到 CookieOverflow 错误。
Tracking and debugging a CookieStore::CookieOverflow error it's not simple. You should try to replicate exactly the same user activity on the site.
A couple of suggestions to fix the error:
* switch to a more scalable cookie storage such as ActiveRecord or Memcached
* try to reduce the number of elements stored in session
Also note that flash messages are stored in session. If you send back a really long flash message text you might expect a CookieOverflow error.
会话中存储的三个日期对象导致了此问题。从会话中删除它们可以阻止错误的发生。
Three Date objects stored in the session were causing this. Removing them from the session stopped the error from happening.