[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

REXML thread-safe?

Kris Rasmussen

5/5/2008 11:31:00 PM

I am processing a lot of RSS using REXML and am hitting exceptions when
running multiple threads (using JRuby). The exception always occurs when
trying to access attributes on the same line of my code but at random
times when I am running more than 1 thread. It does not happen when I
run regular ruby, but green threads are probably less likely to switch
context at the wrong time.

I noticed that in element.rb REXML has a class variable @@namespaces
declared, however I could not find where it was used. The exception is
always thrown in a section of code that deals with namespaces so I'm
wondering if it is related.

I was hoping someone could let me know if REXML is supposed to be thread
safe (one instance per thread)?

Thanks!

--------------

More details...

The exception is thrown on line 234 of rexml/element.rb in JRuby 1.1.1 :

Exception in thread "Ruby Thread16250988" 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.namespace1845016_16032211.__file__(/usr/local/jruby/lib/ruby/1.8/rexml/element.rb:234)
--
Posted via http://www.ruby-....

1 Answer

Kris Rasmussen

5/6/2008 6:09:00 PM

0

This was a bug with JRuby that is fixed in trunk.

--
Posted via http://www.ruby-....