Race condition with Java proxy extenders
----------------------------------------

                 Key: JRUBY-931
                 URL: http://jira.codehaus.org/browse/JRUBY-931
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.0.0RC1
         Environment: Verified on PowerPC OS X with Java 1.5.0_07 and WinXP 
with Java 1.6.0-b105.
            Reporter: Jonathan Paisley
            Priority: Minor
         Attachments: multithread_proxy_extend.rb

The attached sample program reproduces a ConcurrentModificationException due to 
thread-unsafe handling of the proxy extenders list in Java.java. The resolution 
will require some smarter locking, taking care to avoid deadlocks.

Tested against trunk r3642.

Sample output:

AbstractList.java:449:in `java.util.AbstractList$Itr.checkForComodification': 
java.util.ConcurrentModificationException: null (NativeException)
        from AbstractList.java:420:in `java.util.AbstractList$Itr.next'
        from Java.java:318:in `org.jruby.javasupport.Java.get_proxy_class'
        from null:-1:in 
`org.jruby.javasupport.JavaInvokerSget_proxy_class1.call'
        from FastInvocationCallback.java:49:in 
`org.jruby.runtime.callback.FastInvocationCallback.execute'
        from SimpleCallbackMethod.java:81:in 
`org.jruby.internal.runtime.methods.SimpleCallbackMethod.call'
        from EvaluationState.java:563:in 
`org.jruby.evaluator.EvaluationState.callNode'
        from EvaluationState.java:205:in 
`org.jruby.evaluator.EvaluationState.evalInternal'
        from EvaluationState.java:162:in 
`org.jruby.evaluator.EvaluationState.eval'
         ... 74 levels...
        from Main.java:95:in `org.jruby.Main.main'
        from :-1:in `each'
        from multithread_proxy_extend:23
Complete Java stackTrace
java.util.ConcurrentModificationException
        at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
        at java.util.AbstractList$Itr.next(AbstractList.java:420)
        at org.jruby.javasupport.Java.get_proxy_class(Java.java:318)
        at org.jruby.javasupport.JavaInvokerSget_proxy_class1.call(Unknown 
Source)
        at 
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:49)
        at 
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:81)
        at 
org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:563)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:205)
        at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:162)
        at org.jruby.runtime.Block.yield(Block.java:220)
        at org.jruby.runtime.Block.yield(Block.java:186)
        at org.jruby.RubyArray.each(RubyArray.java:1278)
        at org.jruby.RubyArrayInvokereach0.call(Unknown Source)
        at 
org.jruby.runtime.callback.InvocationCallback.execute(InvocationCallback.java:49)
        at 
org.jruby.internal.runtime.methods.FullFunctionCallbackMethod.internalCall(FullFunctionCallbackMethod.java:79)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
        at 
org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:576)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:205)
        at 
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:521)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:199)
        at 
org.jruby.evaluator.EvaluationState.rootNode(EvaluationState.java:1620)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:354)
        at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:162)
        at org.jruby.Ruby.eval(Ruby.java:276)
        at org.jruby.Main.runInterpreter(Main.java:233)
        at org.jruby.Main.runInterpreter(Main.java:190)
        at org.jruby.Main.run(Main.java:120)
        at org.jruby.Main.main(Main.java:95)


-- 
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

Reply via email to