# Memcache\_client fails Marshal.load of AR objects

**URL:** <https://www.ruby-forum.com/t/memcache-client-fails-marshal-load-of-ar-objects/131844>\
**Category:** Rails\
**Created:** [March 13, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/memcache-client-fails-marshal-load-of-ar-objects/131844 "2008-03-13T19:00:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddancer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ecb155/32.png) [@ddancer](https://www.ruby-forum.com/u/ddancer)\
**Post date:** [March 13, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/memcache-client-fails-marshal-load-of-ar-objects/131844/1 "2008-03-13T19:00:46Z")

</div>

wondering if anyone watching can make sense of this,

I’m try to work the memcache\_client into my app, but every time it tries  
to read from memcache I get a Marshall error that the AR classes are not  
defined. But it’s more vexing than that, as the error does not occur  
within the console. From a console everything works as expected, but  
when running in the app it fails.

Here is the backtrace…

Memcacher Exception Caught:

undefined class/module ModuleCategory

Exception Message:

undefined class/module ModuleCategory

Stack Trace:

./script/…/config/…/vendor/gems/memcache-client-1.5.0/lib/memcache.rb:214:in  
`load' ./script/../config/../vendor/gems/memcache-client-1.5.0/lib/memcache.rb:214:in`get’  
/home/andy/stringsDB/external/lib/memcacher.rb:21:in `memcache_me' /home/andy/stringsDB/external/app/controllers/strings_controller.rb:11:in`index’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/base.rb:1101:in  
`send' /home/andy/stringsDB/external/vendor/rails/actionpack/lib/action_controller/base.rb:1101:in`perform\_action\_without\_filters’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/filters.rb:696:in  
`call_filters' /home/andy/stringsDB/external/vendor/rails/actionpack/lib/action_controller/filters.rb:688:in`perform\_action\_without\_benchmark’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/benchmarking.rb:66:in  
`perform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/benchmarking.rb:66:in  
`perform_action_without_rescue' /home/andy/stringsDB/external/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in`perform\_action\_without\_caching’  
/home/andy/stringsDB/external/vendor/plugins/query\_cache/lib/query\_cache.rb:133:in  
`perform_action' /home/andy/stringsDB/external/vendor/plugins/query_cache/lib/query_cache.rb:106:in`cache’  
/home/andy/stringsDB/external/vendor/plugins/query\_cache/lib/query\_cache.rb:132:in  
`perform_action' /home/andy/stringsDB/external/vendor/rails/actionpack/lib/action_controller/base.rb:435:in`send’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/base.rb:435:in  
`process_without_filters' /home/andy/stringsDB/external/vendor/rails/actionpack/lib/action_controller/filters.rb:684:in`process\_without\_session\_management\_support’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/session\_management.rb:114:in  
`sass_old_process' /home/andy/stringsDB/external/vendor/plugins/haml_sass/lib/sass/plugin.rb:124:in`process’  
/home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/base.rb:334:in  
`process' /home/andy/stringsDB/external/vendor/rails/railties/lib/dispatcher.rb:41:in`dispatch’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/rails.rb:76:in  
`process' /var/lib/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in`synchronize’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/rails.rb:74:in  
`process' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in`process\_client’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `each' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in`process\_client’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in`initialize’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `new' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in`run’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `initialize' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in`new’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `run' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:282:in`run’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in  
`each' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in`run’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:128:in `run' /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/command.rb:212:in`run’  
/var/lib/gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:281  
/home/andy/stringsDB/external/vendor/rails/activesupport/lib/active\_support/dependencies.rb:488:in  
`load' /home/andy/stringsDB/external/vendor/rails/activesupport/lib/active_support/dependencies.rb:488:in`load’  
/home/andy/stringsDB/external/vendor/rails/activesupport/lib/active\_support/dependencies.rb:342:in  
`new_constants_in' /home/andy/stringsDB/external/vendor/rails/activesupport/lib/active_support/dependencies.rb:488:in`load’  
/home/andy/stringsDB/external/vendor/rails/railties/lib/commands/servers/mongrel.rb:60  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
/home/andy/stringsDB/external/vendor/rails/activesupport/lib/active\_support/dependencies.rb:495:in  
`require' /home/andy/stringsDB/external/vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in`new\_constants\_in’  
/home/andy/stringsDB/external/vendor/rails/activesupport/lib/active\_support/dependencies.rb:495:in  
`require' /home/andy/stringsDB/external/vendor/rails/railties/lib/commands/server.rb:39 script/server:3:in`require’  
script/server:3

---

<div class="post-metadata">

**Author:** ![ddancer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ecb155/32.png) [@ddancer](https://www.ruby-forum.com/u/ddancer)\
**Post date:** [March 13, 2008, 8:16pm UTC](https://www.ruby-forum.com/t/memcache-client-fails-marshal-load-of-ar-objects/131844/2 "2008-03-13T20:16:03Z")

</div>

Andy K. wrote:

> ./script/…/config/…/vendor/gems/memcache-client-1.5.0/lib/memcache.rb:214:in  
> /home/andy/stringsDB/external/vendor/rails/actionpack/lib/action\_controller/filters.rb:696:in  
> /home/andy/stringsDB/external/vendor/plugins/query\_cache/lib/query\_cache.rb:133:in  
> `process_without_session_management_support' /var/lib/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in /var/lib/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `initialize’  
> /var/lib/gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:281  
> `gem\_original\_require’
> 
> >

Found this solution by Wes G. (thanks Wes) that seems to work…  
“[Memcached fails to retrieve object in a different controller - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/100121#215541)”

But I have to say, it seems antithetical in a Rails app. I don’t  
necessarily think this is a memcache\_client issue. I have another app  
that uses memcache\_client and I’ve not had any issue like this - very  
curious.
