[
https://issues.apache.org/jira/browse/JENA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13086564#comment-13086564
]
Simon Helsen commented on JENA-96:
----------------------------------
Paolo, as always, I understand your request, but you have to understand that we
use TDB inside a complex framework and producing an independent piece of code
which exhibits the issue is not simple.
1) The test case I am running first creates about 6000 graphs. Then I start 10
client threads which each execute 50 queries and perform a write every 7th
action. In between each action, I wait about 500ms and the 50 queries cycle
through about 27 different queries which do all sorts of different things on
the data. (I can tweak any of these numbers to simulate different behaviors)
2) when I look at the first problematic stack trace, I have the following:
com.ibm.team.repository.common.TeamRepositoryException: Transaction has already
committed or aborted
at
com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaRdfService.replace(JenaRdfService.java:267)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy234.replace(Unknown Source)
at
com.ibm.team.jfs.indexing.service.internal.task.TripleIndexAgent.updateIndex(TripleIndexAgent.java:383)
at
com.ibm.team.jfs.indexing.service.internal.task.LiveIndexAgent.refreshIndex(LiveIndexAgent.java:944)
at
com.ibm.team.jfs.indexing.service.internal.task.LiveIndexAgent.performConsistencyCheck(LiveIndexAgent.java:686)
at
com.ibm.team.jfs.indexing.service.internal.task.LiveIndexAgent.perform(LiveIndexAgent.java:453)
at
com.ibm.team.jfs.indexing.service.internal.task.AbstractIndexAgent.run(AbstractIndexAgent.java:1061)
at java.lang.Thread.run(Thread.java:736)
Caused by:
com.hp.hpl.jena.tdb.transaction.TDBTransactionException: Transaction has
already committed or aborted
at
com.hp.hpl.jena.tdb.transaction.Transaction.abort(Transaction.java:107)
at com.hp.hpl.jena.tdb.DatasetGraphTxn.abort(DatasetGraphTxn.java:31)
at
com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaTdbProvider.storeOperation(JenaTdbProvider.java:208)
at
com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaTdbProvider.replace(JenaTdbProvider.java:2411)
at
com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaRdfService.replace(JenaRdfService.java:265)
... 14 more
3) Here is the bit of code which causes this:
private <E> E storeOperation(String graphName, ModelWriteActivity<E>
modelWriteActivity) {
long t = System.currentTimeMillis();
DatasetGraphTxn dsGraph = null;
try {
dsGraph = this.store.begin(ReadWrite.WRITE);
Dataset ds = dsGraph.toDataset();
Model m = ds.getNamedModel(graphName);
E e = modelWriteActivity.run(m);
dsGraph.commit();
return e;
} catch (Exception e) {
if (dsGraph != null) {
dsGraph.abort();
}
// TODO handle better
throw new RuntimeException(e);
} finally {
if (dsGraph != null) {
dsGraph.close();
}
//System.out.println("ModelWriteActivity: " +
(System.currentTimeMillis() - t) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
4) when I look at all of this, I can only conclude that the exception
com.hp.hpl.jena.tdb.transaction.TDBTransactionException is thrown by the abort
because the commit before threw an exception (which then disappears). I'll
change my code to make sure to log the original exception (I guess I was not
expecting the abort to throw an exception as well)
> transactional behavior not sound
> --------------------------------
>
> Key: JENA-96
> URL: https://issues.apache.org/jira/browse/JENA-96
> Project: Jena
> Issue Type: Bug
> Components: TDB
> Environment: tx-tdb-0.9.0-20110809.130753-7
> Reporter: Simon Helsen
> Priority: Critical
>
> TDB-TX tx-tdb-0.9.0-20110809.130753-7 has transactionality issues. I am
> seeing the following stack trace:
> com.hp.hpl.jena.tdb.transaction.TDBTransactionException: Transaction has
> already committed or aborted
> at
> com.hp.hpl.jena.tdb.transaction.Transaction.abort(Transaction.java:107)
> at com.hp.hpl.jena.tdb.DatasetGraphTxn.abort(DatasetGraphTxn.java:31)
> at
> com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaTdbProvider.storeOperation(JenaTdbProvider.java:208)
> at
> com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaTdbProvider.replace(JenaTdbProvider.java:2411)
> at
> com.ibm.team.jfs.rdf.internal.jenatdbtx.JenaRdfService.replace(JenaRdfService.java:265)
> ... 14 more
> I use the following bit of code to execute writes:
> DatasetGraphTxn dsGraph = null;
> try {
> dsGraph = this.store.begin(ReadWrite.WRITE);
> Dataset ds = dsGraph.toDataset();
> Model m = ds.getNamedModel(graphName);
> E e = modelWriteActivity.run(m);
> dsGraph.commit();
> return e;
> } catch (Exception e) {
> if (dsGraph != null) {
> dsGraph.abort();
> }
> // TODO handle better
> throw new RuntimeException(e);
> } finally {
> if (dsGraph != null) {
> dsGraph.close();
> }
> //System.out.println("ModelWriteActivity: " +
> (System.currentTimeMillis() - t) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
> }
> The only thing I do in the ModelWriteActivity is
> model.removeAll();
> model.add(graph);
> As you can see, there is nothing in here which could have made it possible
> that the transaction has committed before. Moreover I only see this happening
> when I am executing massive concurrent reads/writes. Sequential operations do
> not expose this problem.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira