db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Westfall (JIRA)" <j...@apache.org>
Subject [jira] Created: (OJB-114) Concurrency issue with between RsIterator.finalize() and PersistenceBrokerAbstractImpl.
Date Thu, 22 Jun 2006 19:40:32 GMT
Concurrency issue with between RsIterator.finalize() and PersistenceBrokerAbstractImpl.
---------------------------------------------------------------------------------------

         Key: OJB-114
         URL: http://issues.apache.org/jira/browse/OJB-114
     Project: OJB
        Type: Bug

  Components: PB-API  
    Versions: 1.0.4    
    Reporter: Eric Westfall


I have a long running process that does quite a bit of data manipulation.  It is a single
threaded app that starts up Spring, does it's work, then ends.  It runs from the command line.

All the database work happens in a single Spring managed transaction against a single Oracle
database.

If this process runs for a while, I will receive an exception in the log like this:

2006-06-21 18:59:27,619 [Finalizer] ERROR org.apache.ojb.broker.accesslayer.ReportQueryRsIterator
:: Error when try to remove RsIterator resource listener
java.lang.ArrayIndexOutOfBoundsException: 107
        at org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(Unknown
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.release(Unknown Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(Unknown
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.finalize(Unknown Source)
        at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

This might happen many times during the process.  The process doesn't stop running after one
of these exceptions.  At the end of the run, when Spring should commit the transaction, it
does a rollback with this message:

2006-06-21 19:09:19,786 [main] ERROR
org.springframework.orm.ojb.PersistenceBrokerTransactionManager ::
Commit exception overridden by rollback exception java.lang.NullPointerException
        at org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.notifiyStateListener(Unknown
Source)
        at org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.fireBrokerEvent(Unknown
Source)
        at org.apache.ojb.broker.core.PersistenceBrokerImpl.commitTransaction(Unknown
Source)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unknown
Source)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unknown
Source)
        at org.springframework.orm.ojb.PersistenceBrokerTransactionManager.doCommit(PersistenceBrokerTransactionManager.java:251)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:500)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:473)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:267)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
        at $Proxy87.postMainEntries(Unknown Source)
        at org.kuali.module.gl.batch.PosterEntriesStep.performStep(PosterEntriesStep.java:44)
        at org.kuali.core.batch.CommandLineStepRunner.main(CommandLineStepRunner.java:63)
2006-06-21 19:09:19,787 [main] ERROR
org.apache.ojb.broker.core.PersistenceBrokerImpl :: Broker is still in PB-transaction, do
automatic abort before close!

This is the result of a concurrency issue between the thread which is running the finalizer
and the main application thread both modifying the arrays.  I have attached a fix to this
which basically involved getting the newest versions of the IndentityArrayList and PersistenceBrokerAbstractImpl
from the 1.0.5 branch in the repository, and synchronizing access to the collections within
the PersistenceBrokerAbstractImpl.  The original versions of those two files from 1.0.5 can
be found here:

http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/IdentityArrayList.java?view=log
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerAbstractImpl.java?view=log

The fixed version of PersistenceBrokerAbstractImpl is attached.  We verified this with the
same batch job and it now runs without the above errors.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message