Rails 错误:ActionDispatch::Cookies::CookieOverflow

问题描述 投票:0回答:1

我在堆栈溢出上看到有多个关于此主题的帖子,但无法应用它们。

我的应用程序中出现了一个我不明白的 Rails 错误:“ActionDispatch::Cookies::CookieOverflow”(sentry.io 中的错误标题)

我在我的应用程序中根本没有使用 Cookie - 至少不是自定义的 - 但我认为:

  1. devise,我正在使用的身份验证宝石,正在使用cookie。我不清楚这如何产生溢出
  2. wkhtml,我在 stackoverflow 上读到这个工具以某种方式使用 Cookie,但没有任何线索。但一般我用它来生成 PDF

由于客户一定生成了此错误,我不知道如何重现它,这对于弄清楚发生了什么情况很有用。

请提供如何重现和/或解决此问题的可执行说明。

来自sentry.io的堆栈跟踪(根据评论中的要求):

我看不到那里的任何东西,因此我没有发布它

ActionDispatch::Cookies::CookieOverflow

actionpack (6.0.3.6) lib/action_dispatch/middleware/cookies.rb in commit at line 637
actionpack (6.0.3.6) lib/action_dispatch/middleware/cookies.rb in []= at line 472
actionpack (6.0.3.6) lib/action_dispatch/middleware/session/cookie_store.rb in set_cookie at line 110
rack (2.2.3) lib/rack/session/abstract/id.rb in commit_session at line 403
rack (2.2.3) lib/rack/session/abstract/id.rb in context at line 268
rack (2.2.3) lib/rack/session/abstract/id.rb in call at line 260
actionpack (6.0.3.6) lib/action_dispatch/middleware/cookies.rb in call at line 648
actionpack (6.0.3.6) lib/action_dispatch/middleware/callbacks.rb in block in call at line 27
activesupport (6.0.3.6) lib/active_support/callbacks.rb in run_callbacks at line 101
actionpack (6.0.3.6) lib/action_dispatch/middleware/callbacks.rb in call at line 26
actionpack (6.0.3.6) lib/action_dispatch/middleware/actionable_exceptions.rb in call at line 18
actionpack (6.0.3.6) lib/action_dispatch/middleware/debug_exceptions.rb in call at line 32
actionpack (6.0.3.6) lib/action_dispatch/middleware/show_exceptions.rb in call at line 33
railties (6.0.3.6) lib/rails/rack/logger.rb in call_app at line 37
railties (6.0.3.6) lib/rails/rack/logger.rb in block in call at line 26
activesupport (6.0.3.6) lib/active_support/tagged_logging.rb in block in tagged at line 80
activesupport (6.0.3.6) lib/active_support/tagged_logging.rb in tagged at line 28
activesupport (6.0.3.6) lib/active_support/tagged_logging.rb in tagged at line 80
railties (6.0.3.6) lib/rails/rack/logger.rb in call at line 26
actionpack (6.0.3.6) lib/action_dispatch/middleware/remote_ip.rb in call at line 81
actionpack (6.0.3.6) lib/action_dispatch/middleware/request_id.rb in call at line 27
rack (2.2.3) lib/rack/method_override.rb in call at line 24
rack (2.2.3) lib/rack/runtime.rb in call at line 22
activesupport (6.0.3.6) lib/active_support/cache/strategy/local_cache_middleware.rb in call at line 29
actionpack (6.0.3.6) lib/action_dispatch/middleware/executor.rb in call at line 14
rack (2.2.3) lib/rack/sendfile.rb in call at line 110
actionpack (6.0.3.6) lib/action_dispatch/middleware/host_authorization.rb in call at line 76
sentry-ruby-core (4.3.2) lib/sentry/rack/capture_exceptions.rb in block in call at line 23
sentry-ruby-core (4.3.2) lib/sentry/hub.rb in with_scope at line 52
sentry-ruby-core (4.3.2) lib/sentry-ruby.rb in with_scope at line 147
sentry-ruby-core (4.3.2) lib/sentry/rack/capture_exceptions.rb in call at line 14
railties (6.0.3.6) lib/rails/engine.rb in call at line 527
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb in process_request at line 107

/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb in accept_and_process_next_request at line 149

/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb in main_loop at line 110

/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb in block (3 levels) in start_threads at line 419

/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb in block in create_thread_and_abort_on_exception at line 113
ruby-on-rails ruby cookies cookiestore
1个回答
0
投票

CookieOverflow
是当 cookie 存储(用于会话)超出 4kB 限制时引起的。很多事情都可能导致此问题,如果您愿意,您可以尝试追踪导致此问题的原因,看看是否可以更改/修复它,或者您可以使用不同的会话存储

© www.soinside.com 2019 - 2024. All rights reserved.