Closed mavenlink closed 11 years ago
Another place where dalli does not gracefully handle memcached not running is when invalidating a cache. Ideally it would rescue from this exception and output an informative message, like it does in other places.
Dalli::RingError (No server available):
dalli (2.0.2) lib/dalli/ring.rb:45:in `server_for_key'
dalli (2.0.2) lib/dalli/client.rb:249:in `perform'
dalli (2.0.2) lib/dalli/client.rb:138:in `delete'
dalli (2.0.2) lib/active_support/cache/dalli_store.rb:75:in `delete'
actionpack (3.2.3) lib/action_controller/caching/fragments.rb:117:in `block in expire_fragment'
actionpack (3.2.3) lib/action_controller/caching/fragments.rb:123:in `block in instrument_fragment_cache'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_controller/caching/fragments.rb:123:in `instrument_fragment_cache'
actionpack (3.2.3) lib/action_controller/caching/fragments.rb:113:in `expire_fragment'
@caseysackett Thanks, that's a bug which I can easily fix.
@mavenlink I honestly don't see how you are getting that trace. Are you monkeypatching Dalli?
We saw it in https://github.com/mavenlink/morlock (our new locking gem) when we either didn't start a memcached server, or killed the running one.
We are testing a condition where the memcached server is unavailable.
In memcache-client a sensible MemCacheError is raised:
MemCache::MemCacheError: No connection to server (localhost:11211 DEAD (Errno::ECONNREFUSED: Connection refused - connect(2)), will retry at Mon Apr 09 12:23:52 -0700 2012)
However in Dalli we get a much less useful result:
NoMethodError: private method
split' called for true:TrueClass from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/server.rb:29:ininitialize' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/client.rb:234:in
new' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/client.rb:234:inring' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/client.rb:233:in
map' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/client.rb:233:inring' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/client.rb:249:in
perform' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/dalli-2.0.2/lib/dalli/client.rb:126:inadd_without_newrelic_trace' from (eval):7:in
add' from /Users/mavenlink/.rvm/gems/ree-1.8.7-2012.01@mavenlink/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:242:intrace_execution_scoped' from (eval):4:in
add' from /Users/mavenlink/workspace/morlock/lib/morlock/gem_client.rb:30:inadd' from /Users/mavenlink/workspace/morlock/lib/morlock/base.rb:13:in
lock' from (irb):2`