Ruby Forum Ruby on Rails > memcache_client fails Marshal.load of AR objects

Posted by Andy Koch (andykoch)
on 13.03.2008 19:00
(Received via mailing list)
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
Posted by Andy Koch (andykoch)
on 13.03.2008 20:16
(Received via mailing list)
Andy Koch 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 Gamble (thanks Wes) that seems to work...
"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.