【问题标题】:Warning! ActionDispatch::Session::CacheStore failed to save session. Content dropped. in logfile警告! ActionDispatch::Session::CacheStore 未能保存会话。内容被丢弃。在日志文件中
【发布时间】:2016-03-20 12:34:26
【问题描述】:

我正在运行一个 Rails 4 应用程序,我在 Heroku 上的生产日志中看到了这一点。我经常看到它,据报道有些用户被注销了,我在日志中看不到任何表明它发生的原因。我没有看到任何来自 dalli 的无法保存的信息。对于大多数用户来说,它工作得很好。有关如何追捕此问题的任何提示?

生产日志中的错误消息

Warning! ActionDispatch::Session::CacheStore failed to save session. Content dropped.

我的生产配置

  config.cache_store = :dalli_store,
      (ENV["MEMCACHIER_SERVERS"] || "").split(","),
      {:username => ENV["MEMCACHIER_USERNAME"],
       :password => ENV["MEMCACHIER_PASSWORD"],
       :failover => true,
       :socket_timeout => 1.5,
       :socket_failure_delay => 0.2
      }

  config.session_store = :mem_cache_store

【问题讨论】:

    标签: ruby-on-rails session heroku memcached


    【解决方案1】:

    我发现了导致此错误的问题,我正在使用自定义标头变量来设置会话 ID,并且客户端正在发送 nil,这导致机架无法存储到 nil 会话 ID。我用空白包裹了电话?检查以确保仅在存在有效值并且解决了我的问题时才设置它。

    if(!request.headers["Session"].blank?)
      request.session_options[:id] = request.headers["Session"]
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-13
      • 2020-04-06
      • 1970-01-01
      • 2012-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多