const_missing in Ruby on Rails 2.3.11 raises LoadError
------------------------------------------------------

                 Key: JRUBY-5699
                 URL: http://jira.codehaus.org/browse/JRUBY-5699
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6
         Environment: $jruby --version
jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 f3b6154) (Java HotSpot(TM)
Client VM 1.6.0_24) [linux-i386-java]

$jruby -S gem list
actionmailer (2.3.11)
actionpack (2.3.11)
activerecord (2.3.11)
activeresource (2.3.11)
activesupport (2.3.11)
rack (1.1.2)
rails (2.3.11)
rake (0.8.7)
sources (0.0.1)

$java --version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
2011/04/06 15:58:24 

            Reporter: f_mura_j_h
            Assignee: Thomas E Enebo
            Priority: Trivial
         Attachments: test_rails_app.tar.gz

I run small code by script/runner.  LoadError very rarely occurs in JRuby 1.6.0 
+ Ruby on Rails 2.3.11. 

Run 6000 times. Occurred twice. In MRI, LoadError does not occur. Is there 
maybe a problem with JRuby?

Error is below.
{noformat}
Expected /home/user/workspace/tmp/20110405/r2_3_11_160/lib/my_module.rb to 
define MyModule
/home/user/workspace/tmp/20110405/jruby-1.6.0/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:452:in
 `load_missing_constant'
/home/user/workspace/tmp/20110405/jruby-1.6.0/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:106:in
 `const_missing_with_dependencies'
/home/user/workspace/tmp/20110405/jruby-1.6.0/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:118:in
 `const_missing'
const_missing_test.rb:7:in `(root)'
org/jruby/RubyProc.java:268:in `call'
org/jruby/RubyProc.java:232:in `call'
{noformat}

Attach a small rails project.
{noformat}
$tar xzvf test_rails_app.tar.gz
$cd ~/test_rails_app/
$cat ./lib/my_module.rb
module MyModule
   `ls -l`
   # some code...
end

$jruby -I./lib script/runner const_missing_test.rb
{noformat}

const_missing_test.rb is below.
{noformat}
require 'logger'
$logger = Logger.new('error.txt')

begin
   [*(0..9)].collect do |i|
      Thread.start{ p MyModule }
   end.each{ |t| t.join }
rescue Exception => e
   $logger.error "#{e}\n#{e.backtrace.join("\n")}"
end
{noformat}

Of course, if the following code, I can understand that the problem does not 
occur.
{noformat}
require 'logger'
require 'my_module' # add require
$logger = Logger.new('error.txt')

begin
   [*(0..9)].collect do |i|
      Thread.start{ p MyModule }
   end.each{ |t| t.join }
rescue Exception => e
   $logger.error "#{e}\n#{e.backtrace.join("\n")}"
end
{noformat}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to