Concurrency Issue when JIT is enabled - Calls method from wrong ruby class
--------------------------------------------------------------------------
Key: JRUBY-4301
URL: http://jira.codehaus.org/browse/JRUBY-4301
Project: JRuby
Issue Type: Bug
Components: Compiler, Core Classes/Modules
Affects Versions: JRuby 1.4, JRuby 1.3.1
Reporter: Karthik Krishnan
Priority: Critical
Attachments: jruby_call_test.zip
When there are 2 ruby classes contain a same method name, and when this method
is called concurrently on both classes 'n' times (where n =
jruby.jit.threshold), at the nth time, when calling the method on Class A, the
method of Class B gets called.
We encountered this problem when running JRuby on Rails in ThreadSafe Mode. To
isolate the issue, I have managed to eliminate the dependency of Rails, and
have created a simple Test Case to reproduce the behavior.
The attached zip file contains the following ruby files under ruby_lib folder:
1. MyPayment Ruby class implementing a method do_call()
2. MyCollection Ruby class implementing a method do_call()
3. MainProgram Ruby class implementing a method check() - which invokes the
do_call() method on MyPayment and MyCollection based on a parameter
4. Java Client which invokes two threads - 1.calling MyProgram.check() with
'payment', 2.calling MyProgram.check() with 'collection' as parameters
5. The Thread calls the above methods for 'n + 1' times where n equals
'jruby.jit.threshold' value.
6. There is a shell script called run_test.sh provided in bin folder.
7. Please read the README.txt in the attached zip file on how to run the test.
8. The result would show that starting that at one point, the test would start
FAILING. The result is determined by programatically inspecting the call stack
trace. When the test failed, the call to do_call() method for MyPayment, would
have ended up in MyCollection or viceversa.
I hope I have explained the issue to your understanding. I am attaching the
zip file (excluding the jruby-complete.jar), please add the same to your lib
folder after unzipping the attachment.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
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