[ 
https://issues.apache.org/jira/browse/JENA-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17059075#comment-17059075
 ] 

Andy Seaborne commented on JENA-1861:
-------------------------------------

We can change to use hash functions fromĀ {{org.apache.common.codec.digest}} 
and/or {{org.apache.jena.ext.com.google.common.hash}} except for SHA 224 and 
SHA 384. To be complete, we can simply create digest engines each call.

> Query not thread safe
> ---------------------
>
>                 Key: JENA-1861
>                 URL: https://issues.apache.org/jira/browse/JENA-1861
>             Project: Apache Jena
>          Issue Type: Question
>          Components: ARQ
>    Affects Versions: Jena 3.14.0
>            Reporter: Claus Stadler
>            Priority: Major
>
> Executing the same query object on different RDFConnections is not thread 
> safe:
> I ran into very misleading "NPE in NodeFactory.createLiteral" exceptions when 
> computing SHA256 sums in parallel on different connections backed by 
> different datasets/models using the SAME query object.
> I identified the cause as due to a race condition due to the digestCache used 
> in 
> [ExprDigest|https://github.com/apache/jena/blob/d95b7d295cebaeb2ea41029f4ee7781be94e5e85/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprDigest.java#L33]
> My first question is: Are Query objects - or rather expressions - supposed to 
> carry execution state or is this rather a bug?
> I know that some parts of the Query object, such as result vars, are only 
> initialized on request which makes use of the same Query object in different 
> threads fragile to begin with.
> So my other question is: Given a Query object, is Jena supposed to allow for 
> 'fully initializing' it, such that its execution using Jena's provided 
> facilities (models, datasets, etc) is guaranteed to not modify its state?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to