Forum: Ruby on Rails undefined class/module

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Yash (Guest)
on 2006-04-29 18:20
Hi,

We are running a Rails application in development mode. Intermittenly we
get an error on some pages, saying : undefine class/module User. If we
refresh the page, the error goes away and we see the html correctly
rendered. User is a model defined in the models directory and has been
listed in application.rb as model :user.

I am suprised by the fact that this happens only occasionally. Can
someone suggest what might have gone wrong?

Thanks,
Yash
Mike B. (Guest)
on 2006-04-29 21:27
Yash wrote:
> Hi,
>
> We are running a Rails application in development mode. Intermittenly we
> get an error on some pages, saying : undefine class/module User. If we
> refresh the page, the error goes away and we see the html correctly
> rendered. User is a model defined in the models directory and has been
> listed in application.rb as model :user.
>
> I am suprised by the fact that this happens only occasionally. Can
> someone suggest what might have gone wrong?
>
> Thanks,
> Yash

I have seen this problem too. It seems to happen when the system is
under heavy load. I suspect that the reflection technique used to
get the table details is hitting some timeout when trying to access
the database.
The environment where it occasionally occurs for me is
-- Development mode, Rails 1.0, Ruby 1.8.4
-- Linux
-- Postgres
-- Webrick using SSL
-- Heavy load

My questions:
If a timeout occurs on db access, shouldn't Rails just retry later?
(that would be the robust thing)
How can development mode cause this kind of error? (makes things slower,
yes ... but they shouldn't *break*).

-- Mike B.
phoenix (Guest)
on 2007-01-17 04:09
Mike B. wrote:
> Yash wrote:
>> Hi,
>>
>> We are running a Rails application in development mode. Intermittenly we
>> get an error on some pages, saying : undefine class/module User. If we
>> refresh the page, the error goes away and we see the html correctly
>> rendered. User is a model defined in the models directory and has been
>> listed in application.rb as model :user.
>>
>> I am suprised by the fact that this happens only occasionally. Can
>> someone suggest what might have gone wrong?
>>
>> Thanks,
>> Yash
>
> I have seen this problem too. It seems to happen when the system is
> under heavy load. I suspect that the reflection technique used to
> get the table details is hitting some timeout when trying to access
> the database.
> The environment where it occasionally occurs for me is
> -- Development mode, Rails 1.0, Ruby 1.8.4
> -- Linux
> -- Postgres
> -- Webrick using SSL
> -- Heavy load
>
> My questions:
> If a timeout occurs on db access, shouldn't Rails just retry later?
> (that would be the robust thing)
> How can development mode cause this kind of error? (makes things slower,
> yes ... but they shouldn't *break*).
>
> -- Mike B.

I am under ruby 1.8.5,rails 1.1.6,Development mode,system is not under
heavy load:
require 'Cring'
class QueryController < ApplicationController
......
@@score_cache ||= File.zero?('score.cache') ? Hash.new :
Marshal.load(@@f)
......
It's all right when this Controller be called the first time,then it
will nerver run,just raise this exception:undefined class/module Cring
After restart my Webrick,it will be right just once,then raise
exception!
Andrew S. (Guest)
on 2007-01-17 07:04
phoenix wrote:
> l right when this Controller be called the first time,then it
> will nerver run,just raise this exception:undefined class/module Cring
> After restart my Webrick,it will be right just once,then raise
> exception!

I had similar errors until I updated to Rails 1.2RC2.
This topic is locked and can not be replied to.