Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1619

TransactionException for large query results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 3.9.0
    • Jena 3.10.0
    • TDB2
    • None
    • MacOS 10.14
      Java 1.8.0_161 (Oracle)

    Description

      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.

      Reproduction steps

      • Sample dataset containing 1'000'000 triples
      • Query all triples:
        SELECT * WHERE { ?s ?p ?o . }
      • Copy query results for use outside of transaction:
        ResultSetFactory.copyResults(queryExecution.execSelect());
      • Get any variable of the first result

      All variables are null and the log shows the following exception:

      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)
      

      I have created a minimal example available on GitHub and attached to this issue.

      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

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              dobrist Damien Obrist
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: