Memcached, Stale Cache & Config Problem #350

Open
blj opened this Issue Nov 12, 2012 · 4 comments

Projects

None yet

2 participants

@blj
Contributor
blj commented Nov 12, 2012

I use memcahced server to help radiant to store the output. Unfortunately, I got this error randomly and the website stops working. Even when I did script/console it would come with this error:

/app/models/radiant/config.rb:84:in []':NoMethodError: undefined method[]' for nil:NilClass

The line that is being thrown error is :Rails.cache.read('Radiant::Config')[key].

So I restarted memcached server and then the error disappeared. I wonder whether Radiant has cached something and if it is no longer returned by the cache server, instead of fallback it throws the above error.

@jfahrenkrug
Member

Are you using the dalli gem to talk to memcached?

@blj
Contributor
blj commented Feb 6, 2013

Yes I am using dalli gem.

@jfahrenkrug
Member

Interesting. Does your log say something? Did the memcached server possibly freeze or crash because of too long keys or values? Also, are you using Passenger? If so, adding this to your environment.rb might help:

if defined?(PhusionPassenger)
  PhusionPassenger.on_event(:starting_worker_process) do |forked|
    # Only works with DalliStore
    Rails.cache.reset if forked
  end
end
@blj
Contributor
blj commented Feb 6, 2013

I did not check the log. I do not think the memcached server froze, it was
working with other software. I already have that part in my production.rb.
It certainly did not help.

On Wed, Feb 6, 2013 at 5:30 PM, Johannes Fahrenkrug <
notifications@github.com> wrote:

Interesting. Does your log say something? Did the memcached server
possibly freeze or crash because of too long keys or values? Also, are you
using Passenger? If so, adding this to your environment.rb might help:

if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# Only works with DalliStore
Rails.cache.reset if forked
end
end


Reply to this email directly or view it on GitHubhttps://github.com/radiant/radiant/issues/350#issuecomment-13178786.

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