# Script/console is hanging, Observer issue...?

**URL:** <https://www.ruby-forum.com/t/script-console-is-hanging-observer-issue/114919>\
**Category:** Rails\
**Created:** [September 18, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/script-console-is-hanging-observer-issue/114919 "2007-09-18T20:08:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyfromky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e57/32.png) [@tonyfromky](https://www.ruby-forum.com/u/tonyfromky)\
**Post date:** [September 18, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/script-console-is-hanging-observer-issue/114919/1 "2007-09-18T20:08:19Z")

</div>

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** )

```auto
     # 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”

---

<div class="post-metadata">

**Author:** ![tonyfromky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e57/32.png) [@tonyfromky](https://www.ruby-forum.com/u/tonyfromky)\
**Post date:** [September 19, 2007, 12:53am UTC](https://www.ruby-forum.com/t/script-console-is-hanging-observer-issue/114919/2 "2007-09-19T00:53:01Z")

</div>

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** )
> 
> ```auto
> # 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”
