Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.7, JRuby 1.7.0.pre1
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: Embedding
-
Labels:None
-
Environment:We are getting this when running on Ruboto, but it may be platform independent.
-
Number of attachments :
Description
When we call ScriptingContainer#runScriptlet with the following String:
"defined?(TestAppActivity) == 'constant' && TestAppActivity.instance_methods(false).any?{|m| m.to_sym == :on_resume}"
we occasionally get the following exception:
07-20 13:28:59.074 E/AndroidRuntime( 817): Caused by: java.lang.ArrayIndexOutOfBoundsException 07-20 13:28:59.074 E/AndroidRuntime( 817): at org.jruby.runtime.ThreadContext.popScope(ThreadContext.java:270) 07-20 13:28:59.074 E/AndroidRuntime( 817): at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:139) 07-20 13:28:59.074 E/AndroidRuntime( 817): at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264) 07-20 13:28:59.074 E/AndroidRuntime( 817): at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1257) 07-20 13:28:59.074 E/AndroidRuntime( 817): at java.lang.reflect.Method.invokeNative(Native Method) 07-20 13:28:59.074 E/AndroidRuntime( 817): at java.lang.reflect.Method.invoke(Method.java:507) 07-20 13:28:59.074 E/AndroidRuntime( 817): at org.ruboto.JRubyAdapter.runScriptlet(JRubyAdapter.java:184) 07-20 13:28:59.074 E/AndroidRuntime( 817): at org.ruboto.RubotoActivity.onResume(RubotoActivity.java:1164) 07-20 13:28:59.074 E/AndroidRuntime( 817): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150) 07-20 13:28:59.074 E/AndroidRuntime( 817): at android.app.Activity.performResume(Activity.java:3832) 07-20 13:28:59.074 E/AndroidRuntime( 817): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110) 07-20 13:28:59.074 E/AndroidRuntime( 817): ... 10 more
It may be that the actual Ruby code is not significant.
This sort of thing only seems likely to happen if multiple threads are stepping on each other in ThreadContext, which should not normally be possible. The case where it is possible is if the same ThreadContext is being used unconditionally for what could be multi-threaded logic, rather than always getting the current thread's ThreadContext.