-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document for JRuby users the best practices for thread safety (doc.xpath is not thread-safe on JRuby) #40
Comments
@kares has submitted a fix for this in sparklemotion/nokogiri#1597 |
Ah, my mistake, sparklemotion/nokogiri#1597 does not contain a fix for this. Ignore my previous comment. |
This test was submitted in #1596 by @kares.
I've pushed a branch, |
@flavorjones thanks, was more interested in your input on this (if you have any or know anyone who does). somehow I assumed its meant to be (that basically current status is:
|
@jvshahid Any thoughts on this? |
This test was submitted in #1596 by @kares.
I've rebased the branch |
Why not ? I don't the idea of introducing more flags that the user has to discover and configure properly. I think Nokogiri should DTRT and have a thread local cache. |
I researched this a little bit more. The underlying libraries aren't thread safe. Java DOM's specification doesn't require implementation and |
Updated title to indicate the plan is to document thread-safety limitations, and am deleting the branch with the failing test. |
👍 should be the default despite it having a negative performance impact, |
somehow, I got the impression that
xpath
is thread-safe (even under JRuby)... or at least fixable (with the xpath-support cache) when its just an expr (no binds/fn-handler passed)
but was proven wrong as I added a test :
it either reports incorrect results or in a better case fails with an error such as :
this is caused by re-using the same cached xpath object between threads.
on the other hand, maybe there never was an official guarantee regarding thread-safety.
The text was updated successfully, but these errors were encountered: