Closed bglick closed 12 years ago
Did you ever resolve this? I don't use DJ so I'm not sure how it works (whether it forks workers possibly killing any open sockets, e.g.)
I did some digging under the hood on DJ, and it uses the Daemons gem to fork processes. My suspicion is that this is going to be something similar to the issues with Passenger that are noted in the Dalli documentation. We're going to play around next week with resetting the Dalli connection in DJ's before_start callback. *
Brian Glick* President Aspect 9 m: 215-821-6595 skype: brian-glick bglick@aspect9.com
On Fri, Jul 22, 2011 at 10:48 PM, mperham < reply@reply.github.com>wrote:
Did you ever resolve this? I don't use DJ so I'm not sure how it works (whether it forks workers possibly killing any open sockets, e.g.)
Reply to this email directly or view it on GitHub: https://github.com/mperham/dalli/issues/105#issuecomment-1636287
Were you ever able to fix this? I'm having the same issue now.
@dignoe We never did solve it satisfactorily. We ended up writing a wrapper class for the cache that catches the exception and reloads a new cache object.
When running a job with delayed_job, I get errors when trying to access the Dalli Cache.
The Dalli cache is initialized in environment.rb with the following...
When the code executes
CACHE.get 'my_key'
in my rails app, everything runs fine.When it runs in a delayed_job worker, it errors with
No Server Available
Other info that might help:
I have confirmed that the memcached server is running and is accessible via telnet on localhost:11211 We're running Ruby 1.9.2 under rvm
Stack Trace: /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/dalli-1.0.5/lib/dalli/ring.rb:45:in
server_for_key' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/dalli-1.0.5/lib/dalli/client.rb:239:in
perform' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/dalli-1.0.5/lib/dalli/client.rb:126:inset' /home/brian/OpenChain/lib/open_chain/cache_wrapper.rb:8:in
block in set' /home/brian/OpenChain/lib/open_chain/cache_wrapper.rb:22:inerror_wrap' /home/brian/OpenChain/lib/open_chain/cache_wrapper.rb:8:in
set' /home/brian/OpenChain/app/models/master_setup.rb:35:inupdate_cache' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.8/lib/active_support/callbacks.rb:416:in
_run_find_callbacks' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/base.rb:1457:ininit_with' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/base.rb:915:in
instantiate' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/base.rb:473:inblock in find_by_sql' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/base.rb:473:in
collect!' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/base.rb:473:infind_by_sql' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/relation.rb:64:in
to_a' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/relation/finder_methods.rb:341:infind_first' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/relation/finder_methods.rb:122:in
first' /home/brian/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.8/lib/active_record/base.rb:444:infirst' /home/brian/OpenChain/app/models/master_setup.rb:26:in
init_base_setup' /home/brian/OpenChain/app/models/master_setup.rb:19:inget' /home/brian/OpenChain/app/views/open_mailer/send_generic_exception.text.erb:9:in
_app_views_open_mailer_send_generic_exception_text_erb__24129118_108189210_831379336'