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

ArrayIndexOutOfBoundsException when using TracePoint #5869

Closed
aryeh-looker opened this issue Sep 10, 2019 · 3 comments
Closed

ArrayIndexOutOfBoundsException when using TracePoint #5869

aryeh-looker opened this issue Sep 10, 2019 · 3 comments
Milestone

Comments

@aryeh-looker
Copy link
Contributor

@aryeh-looker aryeh-looker commented Sep 10, 2019

Unfortunately no simple, reproducible case at the moment (the application this occurs in is large and complex) and on an older version of JRuby.

Environment

Provide at least:

  • jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.221-b11 on 1.8.0_221-b11 +jit [darwin-x86_64]
  • using --debug flag for TracePoint support
  • Darwin MacBook-Pro.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Expected Behavior

Without using TracePoint, no ArrayIndexOutOfBoundsException exceptions are thrown.

Actual Behavior

Exceptions when using TracePoint.new(:line)

2019-09-10 11:17:28.956 -0700 [ERROR|00856|] :: Java::JavaLang::ArrayIndexOutOfBoundsException : 0
  org.jruby.Ruby.callEventHooks(Ruby.java:3118)
  org.jruby.runtime.ThreadContext.trace(ThreadContext.java:678)
  org.jruby.ir.runtime.IRRuntimeHelpers.callTrace(IRRuntimeHelpers.java:1995)
@kares
Copy link
Member

@kares kares commented Sep 16, 2019

could you please try 9.2.8.0 ... if the issue reproduces.
since 9.1 likely won't get any fixes.

@enebo
Copy link
Member

@enebo enebo commented Sep 25, 2019

I just glanced at this and that AIOOBE is from accessing the element in a for loop:

            for (int i = 0; i < eventHooks.length; i++) {
                EventHook eventHook = eventHooks[i];

So what is happening in this bug is that in the for i = 0 and eventHooks.length == 1 but then by eventHooks[i] access the eventHook is gone (probably from an event hook being disabled. I have to think this is because multiple threads are enabling/disabling tracepoints.

It is definitely a bug but I will see if I can make a trivial repro or not...

as @kares said. If we fix this on 9.2.x it will not be backported to 9.1.x so you will either a) patch your own release on 9.1.17.0 or entertain b) 9.2.9.0 (assuming there is a simple fix)

@enebo
Copy link
Member

@enebo enebo commented Sep 25, 2019

Actually I think this is easier than I thought in that we should just make a local copy of the array...

@enebo enebo added this to the JRuby 9.2.9.0 milestone Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants