Mark Buquor created JENA-324: -------------------------------- Summary: An exception thrown from commit() leaves the StoreConnection in an inconsistent state. Key: JENA-324 URL: https://issues.apache.org/jira/browse/JENA-324 Project: Apache Jena Issue Type: Bug Components: TDB Affects Versions: TDB 0.9.3, TDB 0.9.2, TDB 0.9.1, TDB 0.9.4 Reporter: Mark Buquor
An exception thrown from commit() leaves the StoreConnection in an inconsistent state. Example: After a commit() throws an IOException in prepare() due to insufficient disk space, I see the following behavior: dataset.isInTransaction() == false dataset.abort() throws TDBTransactionException: "Transaction has already committed or aborted" dataset.end() appears OK dataset.begin(ReadWrite.READ) appears OK dataset.begin(ReadWrite.WRITE) blocks on writersWaiting.acquire() The debugger shows that the transaction is stuck in limbo: active, closed, and unfinished. TransactionManager.activeWriters: 1 TransactionManager.activeTransactions: 1 [Transaction: 151 : Mode=WRITE : State=CLOSED : X:\RELM1\] changesPending=true outcome=UNFINISHED Short of a fix, it looks like the only option to clear the stuck transaction is StoreConnection.expel(location, true), which has the comment "testing only". There's also the indeterminacy of ending a transaction that, as far as I can tell at the Dataset level, may or may not be committed ("Transaction has already committed or aborted"). Rough outline of a commit: state == TxnState.PREPARING -- commitPrepare() -- journal.write() -- journal.sync() // Commit point. state == TxnState.COMMITED -- noteTxnCommit() -- currentReaderView.set(null) -- writersWaiting.release() noteTxnCommit() is called after the commit and performs IO, so it appears that if commit() throws an exception, it's not necessarily true that the transaction is effectively aborted. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira