Damien Obrist created JENA-1619:
-----------------------------------

             Summary: TransactionException for large query results
                 Key: JENA-1619
                 URL: https://issues.apache.org/jira/browse/JENA-1619
             Project: Apache Jena
          Issue Type: Bug
          Components: TDB2
    Affects Versions: Jena 3.9.0
         Environment: MacOS 10.14
Java 1.8.0_161 (Oracle)
            Reporter: Damien Obrist
         Attachments: jena-transaction-exception-master.zip

When querying a TDB2 dataset, I'm observing a suspicious 
{{TransactionException}}, even though the query results have been copied so 
they can be used outside of a transaction. The exception only seems to occur 
when there are many results.
h3. Reproduction steps
 * Sample dataset containing 1'000'000 triples
 * Query all triples:
{code:java}
SELECT * WHERE { ?s ?p ?o . }{code}

 * Copy query results for use outside of transaction:
{code:java}
ResultSetFactory.copyResults(queryExecution.execSelect());{code}

 * Get any variable of the first result

All variables are {{null}} and the log shows the following exception:
{noformat}
org.apache.jena.dboe.transaction.txn.TransactionException: Not in a transaction
        at 
org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
        at 
org.apache.jena.dboe.trans.data.TransBinaryDataFile.read(TransBinaryDataFile.java:182)
        at 
org.apache.jena.tdb2.store.nodetable.TReadAppendFileTransport.read(TReadAppendFileTransport.java:71)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
        at 
org.apache.thrift.protocol.TCompactProtocol.readByte(TCompactProtocol.java:637)
        at 
org.apache.thrift.protocol.TCompactProtocol.readFieldBegin(TCompactProtocol.java:543)
        at org.apache.thrift.TUnion$TUnionStandardScheme.read(TUnion.java:222)
        at org.apache.thrift.TUnion$TUnionStandardScheme.read(TUnion.java:213)
        at org.apache.thrift.TUnion.read(TUnion.java:138)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableTRDF.readNodeFromTable(NodeTableTRDF.java:80)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableNative._retrieveNodeByNodeId(NodeTableNative.java:103)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableNative.getNodeForNodeId(NodeTableNative.java:52)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableCache._retrieveNodeByNodeId(NodeTableCache.java:197)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableCache.getNodeForNodeId(NodeTableCache.java:108)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableWrapper.getNodeForNodeId(NodeTableWrapper.java:52)
        at 
org.apache.jena.tdb2.store.nodetable.NodeTableInline.getNodeForNodeId(NodeTableInline.java:66)
        at org.apache.jena.tdb2.solver.BindingTDB.get1(BindingTDB.java:126)
        at 
org.apache.jena.sparql.engine.binding.BindingBase.get(BindingBase.java:104)
        at org.apache.jena.sparql.core.ResultBinding._get(ResultBinding.java:57)
        at 
org.apache.jena.sparql.core.QuerySolutionBase.get(QuerySolutionBase.java:33)
        at TransactionException.main(TransactionException.java:27)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
        at java.lang.Thread.run(Thread.java:748)
{noformat}
I have created a minimal example available on 
[GitHub|https://github.com/dobrist/jena-transaction-exception] and attached to 
this issue.
h3. Findings
 * The exception doesn't occur for smaller query results
 * This seems to be a regression as it works as expected with Jena 3.8.0
 * Using {{git bisect}} I have identified the commit where this starts to 
happen: 
[9a60253|https://github.com/apache/jena/commit/9a60253c00aec6763adbb0253588fe4dc0b484d4]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to