[Mongrel] Undefined class/module error: solved?

Ian C. Blenke ian at blenke.com
Tue Sep 5 17:57:14 EDT 2006

The Problem

We have been getting a "undefined class/module" error on 2 of our 6 app 
servers in one testbed.

Same sourcecode, same installs (systemimager and an isconf style 
configuration management harness), same binaries.
Identical everything. Pound + mongrel + memcached + postgres (pgcluster).

The odd bit here is that our "dev" and "prod" pairs had one node 
reporting the error, but the other node did not.
The "qa" pair worked just fine with both app servers, without incident.

Jason Hall reported the same thing on IRC, and we compared notes.

Basically, the problem looks identical to this unanswered RubyForge error:


Here is a snippet from the logs where I was seeing the problem:

undefined class/module Project
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'

All of them identical. An error restoring an object from a memcached 

I caught Zed online and asked about it, he suggested removing any 
"complex datatypes from the session".

I was going this direction when Jason Hall found a "solution":

The Solution

Jason Hall found a workaround: merely add a "model" line to the 
app/controller/application.rb, and those

model :user, :group, :project

 From what I've been told, "model" is deprecated in Edge Rails, so this 
isn't a permanent solution.
But this does make for an interim workaround.

I guess my question is: why would a class be undefined? Is this some 
kind of a loadpath issue?

- Ian C. Blenke <ian at blenke.com> http://ian.blenke.com/

More information about the Mongrel-users mailing list