-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Occasional ArrayIndexOutOfBoundsException from a line of Ruby that isn't doing array lookups #3729
Comments
its likely to be at thread-safety issue - this kind of failures (usually) happens when an array instance is being accessed concurrently. |
I'm facing the same intermittent issue. It would be nice if the actual point in the Ruby (not Java) code would be indicated. That would help fix the issue in your code. Here's what JRuby tells me: https://gist.github.com/jmettraux/91e04143828e22259aa06390ad7a1d28 not a single pointer to my code. Context:
Thanks for JRuby. |
@jmettraux haven't looked, but could you please confirm its there in the latest of JRuby 1.7 (1.7.26 atm) |
@kares OK, give me some time to gather the info. |
@kares I made a testbed at https://github.com/jmettraux/jruby-gh3729 It happens on the main thread. When happening in another thread, there is a useful indication like:
No such info when on the main thread (see below). The code looks like ( https://github.com/jmettraux/jruby-gh3729/blob/master/test.rb ): a = []
Thread.new do
loop do
a << Time.now.to_f
end
end
1000.times do
p a.collect { |f| f.to_i }.size
end sample output ( https://github.com/jmettraux/jruby-gh3729/blob/master/sample-output.txt ):
Seen on JRuby 1.7.19 and 1.7.26 |
@jmettraux aah so its the same concurrency issue -> JRuby's Array should raise but |
Keep up the great work guys! |
Environment
JRuby: JRuby 9.0.5.0
OS: OSX 10.11.1
We don't set
JRUBY_OPTS
. For a change we're running this using the command-line instead of embedding it. We're basically firing up rspec as part of functional testing. None of our command-line options are for changing behaviour in JRuby, other than deliberately settingfile.encoding=UTF-8
for the benefit of Windows, which is not relevant for this run here as I'm on OSX.Gems: rspec-core, rspec-mocks, ci-reporter.
Other environment variables of Ruby relevance:
rbenv is indeed present, although we are not using it when running the tests - the tests run by
<java classname="org.jruby.Main">
from an Ant task.Expected Behaviour
I have a spec written as follows:
Of note, this
Thing#search
method internally performs work in a thread pool, so the callback gets called from multiple threads, possibly all simultaneously. So the issue I'm about to describe could be a thread safety bug.Of course I expect this test to pass. ;)
(But due to other circumstances, the test fails about half the time, because this search method ultimately calls the callback on multiple threads and rspec-mocks is not thread-safe. That's another issue and not what I'm reporting here.)
Actual Behaviour
Occasionally (1 per 20 runs or so, based on today's runs), I get this failure instead:
Line 42 is this one:
No call to Array#map on that line, no array lookups either, no idea what is going on.
The text was updated successfully, but these errors were encountered: