You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Simon Helsen (JIRA)" <ji...@apache.org> on 2013/01/22 16:00:19 UTC

[jira] [Created] (JENA-385) NPE during abort

Simon Helsen created JENA-385:
---------------------------------

             Summary: NPE during abort
                 Key: JENA-385
                 URL: https://issues.apache.org/jira/browse/JENA-385
             Project: Apache Jena
          Issue Type: Bug
          Components: TDB
    Affects Versions: TDB 0.9.4
            Reporter: Simon Helsen


we ran into a non-reproducible glitch where a transaction was unable to commit (we don't know exactly why - could be a network glitch or hard drive hickup). As a consequence, an abort was initiated which let to an NPE because the journalObjfile was already null. It happens in the following code in NodeTableTrans on the call to truncate. 

    public void abort(Transaction txn)
    {
        debug("abort") ;
        if ( nodeTableJournal == null )
            throw new TDBTransactionException(txn.getLabel()+": Not in a transaction for a commit to happen") ;
        // Ensure the cache does not flush.
        nodeTableJournal = null ;
        // then make sure the journal file is empty.
        journalObjFile.truncate(journalObjFileStartOffset) ;
        journalObjFile.sync() ;
        finish() ;
    }

Should there not just be a check here to verify if journalObjFile != null? So

    public void abort(Transaction txn)
    {
        debug("abort") ;
        if ( nodeTableJournal == null )
            throw new TDBTransactionException(txn.getLabel()+": Not in a transaction for a commit to happen") ;
        // Ensure the cache does not flush.
        nodeTableJournal = null ;
        // then make sure the journal file is empty.
        if (journalObjFile != null) {
           journalObjFile.truncate(journalObjFileStartOffset) ;
           journalObjFile.sync() ;
        }
        finish() ;
    }

--
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