【问题标题】:Heroku, Rails 3.1 and DalliHeroku、Rails 3.1 和 Dalli
【发布时间】:2011-09-12 16:44:32
【问题描述】:

在使用带有 Rails 3.1 的 Heroku 上的 Dalli 时遇到一些资产缓存问题。这些是我的日志中的错误:

2011-09-12T16:37:52+00:00 app[web.1]: Started GET "/assets/bg.png" for 68.33.34.109 at 2011-09-12 16:37:52 +0000
2011-09-12T16:37:52+00:00 app[web.1]: cache: [GET /assets/bg.png] miss, store
2011-09-12T16:37:52+00:00 app[web.1]: !! Rack application returned nil body. Probably you wanted it to be an empty string?
2011-09-12T16:37:52+00:00 app[web.1]: !! Unexpected error while processing request: undefined method `each' for nil:NilClass
2011-09-12T16:37:52+00:00 app[web.1]: cache: [GET /assets/screenshots/2-76481ad827eb34e33208c68196c57401.png] miss
2011-09-12T16:37:52+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET countr.boxfirepress.com/assets/bg.png dyno=web.1 queue= wait= service= status=503 bytes=
2011-09-12T16:37:52+00:00 heroku[router]: GET countr.boxfirepress.com/assets/screenshots/2-76481ad827eb34e33208c68196c57401.png dyno=web.1 queue=0 wait=0ms service=5ms status=200 bytes=48355
2011-09-12T16:37:52+00:00 app[web.1]: cache: [GET /assets/screenshots/3-4fd3fe37a5915dec391663720fcbb7d4.png] miss
2011-09-12T16:37:52+00:00 heroku[router]: GET countr.boxfirepress.com/assets/screenshots/3-4fd3fe37a5915dec391663720fcbb7d4.png dyno=web.1 queue=0 wait=0ms service=8ms status=200 bytes=26464

并且,在控制台中:

irb(main):001:0> Rails.cache.clear
localhost:11211 failed (count: 0)
Dalli::NetworkError: localhost:11211 is down:  
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/dalli/server.rb:43:in `request'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/dalli/options.rb:18:in `block in request'
    from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/dalli/options.rb:17:in `request'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/dalli/client.rb:159:in `block in flush'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/dalli/client.rb:159:in `map'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/dalli/client.rb:159:in `flush'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-1.0.5/lib/active_support/cache/dalli_store.rb:103:in `clear'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/cache/strategy/local_cache.rb:88:in `clear'
    from (irb):1
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails-3 heroku memcached


    【解决方案1】:

    Dalli 似乎没有连接到 Memcache 服务器?您是否启用了 Heroku Memcache 插件(或以其他方式配置了 Memcache 服务器)?

    【讨论】:

    • 看起来这是 Heroku 端的问题。他们正在努力。
    • 除 Heroku 之外,这也解决了我的一个错误,并且通常与 Dalli/Memcached 连接错误有关(只是为了我自己)
    猜你喜欢
    • 2012-01-27
    • 1970-01-01
    • 1970-01-01
    • 2012-01-31
    • 2011-11-12
    • 1970-01-01
    • 1970-01-01
    • 2012-04-16
    • 2011-10-30
    相关资源
    最近更新 更多