Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOfBoundException when doing request to app deployed under trinidad 1.4.4 with JRuby 1.7.0 #376

mishaaq opened this issue Nov 7, 2012 · 6 comments


Copy link

mishaaq commented Nov 7, 2012

The application starts properly under trinidad 1.4.4

Starting Servlet Engine: Apache Tomcat/7.0.32
jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.6.0_34-b04 [linux-amd64]
using a shared (threadsafe!) runtime
io/console not supported; tty will not be manipulated
/home/mzarlok/.rvm/gems/jruby-1.7.0@mc/gems/jruby-rack-1.1.10/lib/jruby/rack/version.rb:11 warning: already initialized constant VERSION
2012-11-07 11:30:28 [INFO ] [localhost-startStop-1] filesystem.FilesystemDataStore: The filesystem based datastore initialized at: /tmp with free space available: 30421MB.
Starting ProtocolHandler ["http-bio-8080"]

, but on request the exception is being thrown:

application error
java.lang.ArrayIndexOutOfBoundsException: 0
    at org.jruby.util.Dir.isAbsolutePath(
    at org.jruby.util.Dir.glob_helper(
    at org.jruby.util.Dir.push_globs(
    at org.jruby.util.Dir.push_braces(
    at org.jruby.util.Dir.push_braces(
    at org.jruby.util.Dir.push_glob(
    at org.jruby.RubyDir.aref(
    at org.jruby.RubyDir$INVOKER$s$0$0$$INVOKER$s$0$0$aref.gen)
    at org.jruby.internal.runtime.methods.JavaMethod$

Some debugging hints:
org.jruby.util.Dir.push_glob( method is called with args:

push_glob("/home/mzarlok/Projects/ManagementCenter/subsystems/gui/mc",  {ByteList}"{,.html,/index.html}", 0)

Everything works great when using trinidad 1.4.3.

Copy link

When JVM throws AIOOBE with index 0, it means that somehow it was given an empty array path. It is not clear to me how JRuby ended up in this situation, and trinidad/trinidad@trinidad-1.4.3...trinidad-1.4.4 does not show much in the way of clues.

Copy link

kares commented Dec 19, 2012

@mishaaq would it be possible to get a minimal app where this could be reproduced ?
... I just got another report from @crawlik on JRuby 1.7.1

Copy link

crawlik commented Dec 19, 2012

@kares already mentioned that that I run into the problem... here is some info about my environment, versions and a few observations

using rails 3.2.3
mode development
start using this command rails s trinidad

everything works fine when you have controller in your path like http://localhost:3000/cache but hitting http://localhost:3000/ throws AIOOBE with index 0 and stdout is full of messages like this 'Invalid gemspec in
/home/alex/.rvm/gems/jruby-1.7.1@global/specifications/rake-10.0.3.gemspec]: Valid types are [:development, :runtime] and the end it spits out
error application could not be initialized org.jruby.exceptions.RaiseException: (ArgumentError) Valid types are [:development, :runtime], at Gem::Dependency.initialize(/home/alex/.rvm/rubies/jruby-1.7.1/lib/ruby/shared/rubygems/dependency.rb:49) at RUBY.gem(/home/alex/.rvm/rubies/jruby-1.7.1/lib/ruby/shared/rubygems.rb:1231) at RUBY.(root)(/home/alex/.rvm/gems/jruby-1.7.1@global/gems/bundler-1.2.3/lib/bundler/psyched_yaml.rb:3) at org.jruby.RubyKernel.require(org/jruby/ at RUBY.(root)(/home/alex/.rvm/rubies/jruby-1.7.1/lib/ruby/shared/rubygems/custom_require.rb:1) at RUBY.require(/home/alex/.rvm/rubies/jruby-1.7.1/lib/ruby/shared/rubygems/custom_require.rb:36) at org.jruby.RubyKernel.require(org/jruby/ at RUBY.(root)(/home/alex/.rvm/gems/jruby-1.7.1@global/gems/bundler-1.2.3/lib/bundler.rb:5) at RUBY.(root)(/home/alex/.rvm/rubies/jruby-1.7.1/lib/ruby/shared/rubygems/custom_require.rb:1)

I added custom printouts before line 45 in /home/alex/.rvm/rubies/jruby-1.7.1/lib/ruby/shared/rubygems/dependency.rb

unless TYPES.include? type
45 p '********************'
46 p type.inspect
47 p '--------------------'
48 p TYPES.inspect
49 raise ArgumentError, "Valid types are #{TYPES.inspect}, "
50 + "not #{type.inspect}"
51 end

but it prints all correct values (see below) right before exception, so it is bit a mystery right now why this error is generated

"[:development, :runtime]"
error application could not be initialized

Copy link

mishaaq commented Apr 22, 2013

It's a pity I couldn't find a minimal example of this failure. However after some changes (switching to jruby 1.7.3, updating jruby-rack and doing lot of changes in the project code) trinidad 1.4.4 started to work. Unfortunately I cannot point particular change.

Copy link

@mishaaq Thanks for the report.

@crawlik Do you still see the problem?

Copy link

headius commented Nov 13, 2014

No responses in over a year. Closing.

@headius headius closed this as completed Nov 13, 2014
@headius headius added this to the Invalid or Duplicate milestone Nov 13, 2014
aitherios added a commit to aitherios/rails_with_crystal that referenced this issue Jan 6, 2015
eregon added a commit that referenced this issue Jan 27, 2017
fb3e3ac Remove redundant specs
89b75f6 Write to an external file instead of using output_to_fd
a1837cb If you change the max of a sized queue, the old items beyond the max remain
f3b9b2d change TruffleRuby's RUBY_ENGINE to ruby until we are recognised by rubygems
5792e29 Simplify Array#sample spec and avoid #itself
1af4646 add array sample randomness spec
086ccc5 Fix a spec typo
ac4cabf Add link to TruffleRuby
8dcc2ca Remove old JRuby+Truffle link
c8eda60 Add spec for Enumerable#chunk_while with single element.
f8e0ea5 Add spec for invalid rescue clauses
19ec73a Spec for rescue comparing against classes using ===
61b4c61 add spec for String#scan's output when passed block has multiple arguments
6047836 Fix bad spec which inadvertently passed due to have_data.
2268696 Replace have_data matchers with ==
ca87e50 Merge pull request #383 from manu-crealytics/gzipreader_enumerator_specs
1c4d467 Extend GzipReader specs to cover returned Enumerators.
859eeb0 Kerenel#warn no longer splats an array in 2.5 (#382)
cee9571 Extract to a fixture to ease retrying
0079c36 Merge pull request #379 from kachick/2.4-match-p
9b95f54 Merge pull request #377 from kachick/hash-transform_values
96735c5 Merge pull request #376 from kachick/hash-compact
5be340b Write specs around {String|Symbol}#match?
95b9bbb Write specs around Regexp#match?
ef69806 Merge pull request #375 from kachick/concat-prepend-with-multi-arg
9496ea5 Remove suspicious spec
28a88ed Remove empty WIN32OLE specs
ab2925b Retry on failure
db38e03 Avoid double error
2d281a2 Temporarily disable new spec for String#each_line in 2.5 as Travis trunk lags
2d08e6d Enable 2.4.0 in CI
80f92c2 Write Hash#transform_values! specs around frozen
5611438 Write Hash#transform_values! specs
4d31731 Write Hash#transform_values specs
906bd11 suppress error for a while
dd2360f Write Hash#compact{!} specs
6f66a66 Add Array#concat with multiple arguments
d650d57 Add String#concat with multiple arguments
9020e16 Add String#prepend with multiple arguments
c4a0aa2 Sort by versions
85b2434 Merge pull request #371 from vais/windows
eaf3da5 There is no /dev/tty on Windows, but the rest of the tty spec works
9b81e7d Don't leave zombie IE processes hanging around after specs finish running
f9e6b34 There is no /dev/tty on Windows
dc9c3e1 Silence the nuisance "'does_not_exist' is not recognized..." message

git-subtree-dir: spec/ruby
git-subtree-split: fb3e3ac203386b2b82a7787490ed4f861ab4169e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

5 participants