Issue Type: Bug Bug
Affects Versions: JRuby 1.6.8
Assignee: Thomas E Enebo
Components: Ruby 1.9.2
Created: 11/Oct/12 9:14 PM
Description:

When running a multithreaded Rails 3.2 application in Ruby 1.9 mode (using "--1.9"), I get this stack trace every time I send traffic to that application:

load error: active_record/associations/association_scope -- java.lang.NegativeArraySizeException: null
java/lang/Thread.java:1479:in `getStackTrace'
org/jruby/runtime/backtrace/TraceType.java:73:in `getBacktraceData'
org/jruby/runtime/backtrace/TraceType.java:111:in `getBacktraceData'
org/jruby/runtime/backtrace/TraceType.java:25:in `getBacktrace'
org/jruby/RubyException.java:160:in `prepareBacktrace'
org/jruby/exceptions/RaiseException.java:205:in `preRaise'
org/jruby/exceptions/RaiseException.java:195:in `preRaise'
org/jruby/exceptions/RaiseException.java:112:in `<init>'
org/jruby/Ruby.java:3386:in `newRaiseException'
org/jruby/Ruby.java:3272:in `newLoadError'
org/jruby/runtime/load/LoadService.java:773:in `newLoadErrorFromThrowable'
org/jruby/runtime/load/LoadService.java:766:in `tryLoadingLibraryOrScript'
org/jruby/runtime/load/LoadService.java:332:in `smartLoad'
org/jruby/runtime/load/LoadService.java:381:in `require'
org/jruby/runtime/load/LoadService.java:304:in `lockAndRequire'
org/jruby/RubyKernel.java:198:in `load'
org/jruby/RubyModule.java:3598:in `getConstant'
org/jruby/RubyModule.java:3428:in `getAutoloadConstant'
org/jruby/RubyModule.java:2979:in `resolveUndefConstant'
org/jruby/parser/StaticScope.java:191:in `getConstantInner'
org/jruby/parser/StaticScope.java:200:in `getConstantInnerNoObject'
org/jruby/parser/StaticScope.java:194:in `getConstantInner'
org/jruby/parser/StaticScope.java:181:in `getConstant'
org/jruby/runtime/ThreadContext.java:632:in `getConstant'
org/jruby/ast/executable/RuntimeCache.java:407:in `reCache'
org/jruby/ast/executable/RuntimeCache.java:398:in `getValue'
org/jruby/ast/executable/RuntimeCache.java:391:in `getConstant'
org/jruby/ast/executable/AbstractScript.java:281:in `getConstant3'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:98:in `association_scope'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__12$RUBY$association_scope:65535:in `call'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__12$RUBY$association_scope:65535:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:292:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:135:in `call'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:87:in `scoped'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__11$RUBY$scoped:65535:in `call'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__11$RUBY$scoped:65535:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:292:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:135:in `call'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/singular_association.rb:42:in `find_target'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$singular_association$method__9$RUBY$find_target:65535:in `call'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$singular_association$method__9$RUBY$find_target:65535:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:292:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:135:in `call'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:145:in `__ensure__'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:138:in `load_target'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__17$RUBY$load_target:65535:in `call'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__17$RUBY$load_target:65535:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:292:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:135:in `call'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:55:in `reload'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__6$RUBY$reload:65535:in `call'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$association$method__6$RUBY$reload:65535:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:292:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:135:in `call'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/singular_association.rb:9:in `reader'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$singular_association$method__3$RUBY$reader:65535:in `call'
org/jruby/internal/runtime/methods/DynamicMethod.java:203:in `call'
org/jruby/internal/runtime/methods/CompiledMethod.java:255:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:292:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:135:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:101:in `callVarargs'
/home/user/.rvm/gems/jruby-1.6.8/gems/activerecord-3.2.8/lib/active_record/associations/builder/association.rb:44:in `define_readers'
home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_8$gems$activerecord_minus_3_dot_2_dot_8$lib$active_record$associations$builder$association$block_0$RUBY$define_readers:65535:in `call'
org/jruby/runtime/CompiledBlock19.java:163:in `yield'
org/jruby/runtime/CompiledBlock19.java:91:in `call'

This bug is reproducible always, but interestingly only in the production server setting, not when testing manually (maybe this is traffic dependent, but I doubt this).

This bug seems to be actually at least 2 bugs:

  1. the bug itself, presumably a java.lang.NegativeArraySizeException raised somewhere
  2. catching this exception and discarding its stack trace, thus obscuring its original site where it is create. Instead of this, a new Throwable is created using newLoadErrorFromThrowable() in https://github.com/jruby/jruby/blob/1.6.8/src/org/jruby/runtime/load/LoadService.java#L738 Unfortunately, this new throwable has no links to the original Throwable object (like chaining Throwables or Errors as it is possible using the "cause" parameter in http://docs.oracle.com/javase/7/docs/api/java/lang/Error.html#Error%28java.lang.Throwable%29 since Java 1.4.

Fixing the second bug would enlighten the cause of the first bug.

Project: JRuby
Priority: Major Major
Reporter: Xuân Baldauf
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
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