REXML unusable from multiple threads:  java.lang.ClassCastException: 
org.jruby.RubyString
-----------------------------------------------------------------------------------------

                 Key: JRUBY-2494
                 URL: http://jira.codehaus.org/browse/JRUBY-2494
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.1
         Environment: osx leopord.
            Reporter: Kris Rasmussen
         Attachments: test_threading.rb

I am unable to use REXML from multiple threads with JRuby. If multiple threads 
create a document and enumerate elements, the java exception below is thrown. I 
have looked over the REXML code and didn't see any clear signs that it is not 
thread safe so I'm wondering if this issue is isolated to JRuby. I attached a 
test script. that seems to reproduce the exception on nearly every run.

Exception in thread "Ruby Thread14823514" java.lang.ClassCastException: 
org.jruby.RubyString
        at org.jruby.RubyNilInvoker$nil_p_method_0_0.call(Unknown Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:272)
        at 
ruby.jit.ruby.usr.local.jruby.lib.ruby.$1_dot_8.rexml.element.namespace14942221_15180414.__file__(/usr/local/jruby/lib/ruby/1.8/rexml/element.rb:236)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:648)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.notNode(ASTInterpreter.java:1368)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:420)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyArray.reject_bang(RubyArray.java:1715)
        at org.jruby.RubyArray.delete_if(RubyArray.java:1732)
        at org.jruby.RubyArrayInvoker$delete_if_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:101)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:87)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:256)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:662)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.caseNode(ASTInterpreter.java:729)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:310)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at 
org.jruby.evaluator.ASTInterpreter.whileNode(ASTInterpreter.java:1761)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:489)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:102)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:243)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at 
org.jruby.evaluator.ASTInterpreter.localAsgnNode(ASTInterpreter.java:1256)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:387)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:102)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:243)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:102)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:243)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:102)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:243)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at 
org.jruby.evaluator.ASTInterpreter.localAsgnNode(ASTInterpreter.java:1256)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:387)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:102)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:243)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.call(InterpretedBlock.java:103)
        at org.jruby.runtime.Block.call(Block.java:105)
        at org.jruby.RubyProc.call(RubyProc.java:203)
        at org.jruby.RubyProc.call(RubyProc.java:182)
        at 
org.jruby.internal.runtime.RubyNativeThread.run(RubyNativeThread.java:72)
Exception in thread "Ruby Thread3004038" java.lang.ClassCastException: 
org.jruby.RubyString
        at org.jruby.RubyNilInvoker$nil_p_method_0_0.call(Unknown Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:272)
        at 
ruby.jit.ruby.usr.local.jruby.lib.ruby.$1_dot_8.rexml.element.namespace14942221_15180414.__file__(/usr/local/jruby/lib/ruby/1.8/rexml/element.rb:236)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:78)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:304)
        at 
ruby.jit.ruby.usr.local.jruby.lib.ruby.$1_dot_8.rexml.xpath_parser.get_namespace8161005_15180414.__file__(/usr/local/jruby/lib/ruby/1.8/rexml/xpath_parser.rb:146)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at org.jruby.evaluator.ASTInterpreter.dAsgnNode(ASTInterpreter.java:858)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:328)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyArray.reject_bang(RubyArray.java:1715)
        at org.jruby.RubyArray.delete_if(RubyArray.java:1732)
        at org.jruby.RubyArrayInvoker$delete_if_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:101)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:253)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:662)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.caseNode(ASTInterpreter.java:729)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:310)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at 
org.jruby.evaluator.ASTInterpreter.whileNode(ASTInterpreter.java:1761)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:489)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at 
org.jruby.evaluator.ASTInterpreter.localAsgnNode(ASTInterpreter.java:1256)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:387)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at 
org.jruby.evaluator.ASTInterpreter.localAsgnNode(ASTInterpreter.java:1256)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:387)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:240)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.call(InterpretedBlock.java:103)
        at org.jruby.runtime.Block.call(Block.java:105)
        at org.jruby.RubyProc.call(RubyProc.java:203)
        at org.jruby.RubyProc.call(RubyProc.java:182)
        at 
org.jruby.internal.runtime.RubyNativeThread.run(RubyNativeThread.java:72)

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