After weeks of working fine, yesterday script/console started hanging
upon startup, right after printing “Loading Development Environment.”
I waited several minutes and control-C’d, and got this:
^C/usr/local/lib/ruby/1.8/singleton.rb:150:in sleep': Interrupt from /usr/local/lib/ruby/1.8/singleton.rb:150:in
_instantiate?’
from /usr/local/lib/ruby/1.8/singleton.rb:106:in instance' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/observer.rb:38:in
instantiate_observers’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/observer.rb:36:in
each' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/observer.rb:36:in
instantiate_observers’
from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:212:in
load_observers' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:108:in
process’
from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:43:in
send' ... 51 levels... from /usr/local/lib/ruby/1.8/irb/init.rb:250:in
load_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in setup' from /usr/local/lib/ruby/1.8/irb.rb:54:in
start’
from /usr/local/bin/irb:13
I looked in environment.rb and there’s only one observer. I checked it
against SVN and it hasn’t changed in weeks.
I did some debugging and found that the hang is related to this line in
inflector#constantize:
Object.module_eval("::#{$1}", FILE, LINE)
# File vendor/rails/activesupport/lib/active_support/inflector.rb,
line 245
245: def constantize(camel_cased_word)
246: unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~
camel_cased_word
247: raise NameError, "#{camel_cased_word.inspect} is not a valid
constant name!"
248: end
249:
250: Object.module_eval("::#{$1}", __FILE__, __LINE__)
251: end
What does this line do? The class name being observed is “User”
Update.
I deleted the source code and re-checked it from SVN. Magically,
script/console started behaving. I have no explanation.
However, now it seems mongrel and webrick are experiencing the same
issue. Mongrel won’t come up, it just stalls after “** Starting Rails
with development environment…” A Ctrl-C kills it.
Webrick, however, when Ctrl-C’d, produces the same stack trace as seen
below.
Tony Fromky wrote:
After weeks of working fine, yesterday script/console started hanging
upon startup, right after printing “Loading Development Environment.”
I waited several minutes and control-C’d, and got this:
^C/usr/local/lib/ruby/1.8/singleton.rb:150:in sleep': Interrupt from /usr/local/lib/ruby/1.8/singleton.rb:150:in
_instantiate?’
from /usr/local/lib/ruby/1.8/singleton.rb:106:in instance' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/observer.rb:38:in
instantiate_observers’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/observer.rb:36:in
each' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/observer.rb:36:in
instantiate_observers’
from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:212:in
load_observers' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:108:in
process’
from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:43:in
send' ... 51 levels... from /usr/local/lib/ruby/1.8/irb/init.rb:250:in
load_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in setup' from /usr/local/lib/ruby/1.8/irb.rb:54:in
start’
from /usr/local/bin/irb:13
I looked in environment.rb and there’s only one observer. I checked it
against SVN and it hasn’t changed in weeks.
I did some debugging and found that the hang is related to this line in
inflector#constantize:
Object.module_eval("::#{$1}", FILE, LINE)
# File vendor/rails/activesupport/lib/active_support/inflector.rb,
> line 245
> 245: def constantize(camel_cased_word)
> 246: unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~
> camel_cased_word
> 247: raise NameError, "#{camel_cased_word.inspect} is not a valid
> constant name!"
> 248: end
> 249:
> 250: Object.module_eval("::#{$1}", __FILE__, __LINE__)
> 251: end
What does this line do? The class name being observed is “User”