[
https://issues.apache.org/jira/browse/JENA-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17091325#comment-17091325
]
ASF subversion and git services commented on JENA-1861:
-------------------------------------------------------
Commit 0ef5a2f1a369187e770e6a0363d0af1245d28762 in jena's branch
refs/heads/master from Andy Seaborne
[ https://gitbox.apache.org/repos/asf?p=jena.git;h=0ef5a2f ]
JENA-1861: Thread-safe setResultVars
> 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
> Assignee: Andy Seaborne
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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)