cache: [GET /] miss on default Rails application in production mode Rails 3.2.2 #5245

leonardteo opened this Issue Mar 2, 2012 · 12 comments


None yet
4 participants

Hi all,

I'm not sure if this is an issue (yet) but I've seen this reported in various ways. Basically rails will log cache misses like this:
cache: [GET /] miss
cache: [GET /assets/rails.png] miss

If you deploy this on Phusion Passenger, it fills the error.log file with cache misses.

Here's the steps I've taken to reproduce this issue.

  1. Create a new rails app
    rails new testapp

    cd testapp

  2. Precompile the assets
    rake assets:precompile

  3. Edit production.rb to make it serve static assets
    config.serve_static_assets = true (default is false)

  4. Start webbrick in production mode
    rails server -e production

  5. Point browser to http://localhost:3000
    Rails will log this:

    cache: [GET /] miss
    cache: [GET /assets/rails.png] miss

Rails 3.2.2
Ruby 1.9.2

Curious if anyone else is having this issue and if there's a workaround in the meantime. I've noticed that setting config.action_controller.perform_caching to false will disable caching and hence silence the messages, but I was hoping to take advantage of caching.

Any help would be most appreciated.



spastorino commented Mar 2, 2012

I don't see what's the issue, what happens when you do a second request? perhaps I'm not following but doesn't you get cache miss just the first time? The first time is nothing in the cache so it's fine to get cache miss

You get a cache miss every single time. You can fill up error.log with these cache misses very quickly.


spastorino commented Mar 2, 2012

Can you try using 3.2.2? I don't get that. Second time I get 304 and no cache miss

Yup. Just upgraded to 3.2.2 and I am getting the same issue. (just also edited the original issue post to mention I'm on 3.2.2 now).

I've tried creating a new app with Rails 3.2.2, following the steps described here, and it seems I'm getting the same cache miss results. I couldn't figure out what might be going on yet, looking into it.


spastorino commented Mar 2, 2012

Honestly unsure why I don't get that, seems crazy


spastorino commented Mar 3, 2012

You can test it using curl http://localhost:3000/assets/rails.png you will get the same output as me probably.

Anyway ... env['rack.errors'] is $stderr defined in rack handlers for example ... then writes that to stderr.

Will be working on it ...

@leonardteo After some different attempts here, using Google Chrome, the following works:

  • Remove all cache files: rm -rf tmp/cache/*
  • Clear browse cache: Cmd + Shift + Delete, then mark the empty cache option and click ok (on mac).
  • Restart the server.

After doing that, when hitting http://localhost:3000 I get:

cache: [GET /] miss, store
cache: [GET /assets/rails.png] miss, store
cache: [GET /favicon.ico] miss, store
cache: [GET /] stale, valid, store
cache: [GET /assets/rails.png] stale, valid, store

Which is the expected output.

@carlosantoniodasilva Good one. It works here now after clearing all the cache.

Now I have to figure out why the above trick does not work on my real app. I still get the cache misses. Oh bother...

Should I close this issue?

@leonardteo good to know that worked for you as well. Don't need to close it right know, we will try to figure out if something should be changed for rack-cache to stop all this cache stuff to stderr or not. @spastorino can close it later, after checking that.. Thanks!

spastorino closed this in 14f06dd Mar 3, 2012

@carlosantoniodasilva carlosantoniodasilva pushed a commit to carlosantoniodasilva/rails that referenced this issue Mar 3, 2012

@spastorino spastorino Turn off verbose mode of rack-cache, we still have X-Rack-Cache to ch…
…eck that info

Closes #5245

spastorino commented Mar 3, 2012

BTW I've sent a PR to rack-cache rtomayko/rack-cache#58 after the commit is merged we can rollback verbose to true


rtomayko commented Mar 5, 2012

rtomayko/rack-cache#58 is merged. Release coming soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment