ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthieu Riou" <matth...@offthelip.org>
Subject Re: ERROR 40001: A lock could not be obtained due to a deadlock, cycle of locks and waiters is:
Date Fri, 18 Apr 2008 15:13:09 GMT
Well, it's what it says, deadlock :) Derby is fairly pessimistic in terms of
locking, to a point where in certain situations you can't be sure that a
deadlock will never happen. So there are 2 things you can do:

1. Upgrade to use the latest 1.1 branch version. I've implemented some retry
code so even if they transaction deadlocks, it's retried and usually
succeeds.
2. Change your database to MySQL (innodb) or Postgres. Any MVCC [1] database
would solve this.

Cheers,
Matthieu

[1] http://en.wikipedia.org/wiki/Multiversion_concurrency_control

On Fri, Apr 18, 2008 at 1:11 AM, Piotr Jagielski <pjagiels@gmail.com> wrote:

> Hi all,
>
> When running ODE 1.1.1 on Servicemix with default DB settings
> (OpenJPA, Derby) sometimes following error occurs:
>
> ERROR 40001: A lock could not be obtained due to a deadlock, cycle of
> locks and waiters is:
> Lock : ROW, ODE_JOB, (4,897)
>  Waiting XID : {47453, X} , SA, delete from ODE_JOB where jobid = ?
> and nodeid = ?
>  Granted XID : {47454, X}
> Lock : ROW, ODE_JOB, (5,1106)
>  Waiting XID : {47454, X} , SA, delete from ODE_JOB where jobid = ?
> and nodeid = ?
>  Granted XID : {47453, X}
> . The selected victim is XID : 47453.
>        at
> org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
>        at
> org.apache.derby.impl.services.locks.Deadlock.buildException(Unknown
> Source)
>        at org.apache.derby.impl.services.locks.LockSet.lockObject(Unknown
> Source)
>        at
> org.apache.derby.impl.services.locks.SinglePool.lockAnObject(Unknown
> Source)
>        at
> org.apache.derby.impl.services.locks.SinglePool.lockObject(Unknown
> Source)
>        at
> org.apache.derby.impl.store.raw.xact.RowLocking3.lockRecordForWrite(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR.lockScanRow(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(Unknown
> Source)
>        at
> org.apache.derby.impl.store.access.btree.BTreeScan.fetchNext(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.execute.TableScanResultSet.getNextRowCore(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.execute.IndexRowToBaseRowResultSet.getNextRowCore(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown
> Source)
>        at org.apache.derby.impl.sql.execute.DeleteResultSet.setup(Unknown
> Source)
>        at org.apache.derby.impl.sql.execute.DeleteResultSet.open(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
> Source)
>        at
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> Source)
>        at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
> Source)
>        at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
> Source)
>        at
> org.tranql.connector.jdbc.PreparedStatementHandle.executeUpdate(PreparedStatementHandle.java:103)
>        at
> org.apache.ode.scheduler.simple.JdbcDelegate.deleteJob(JdbcDelegate.java:92)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:343)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:340)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:179)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:339)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:336)
>        at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:799)
>
> After that connection pool seems to be exhausted - every event ends with:
>
> <openjpa-1.0.1-r420667:592145 fatal general error>
> org.apache.openjpa.persistence.PersistenceException: The transaction
> has been rolled back.  See the nested exceptions for details on the
> errors that occurred.
>        at
> org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2107)
>        at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1954)
>        at
> org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1852)
>        at
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1770)
>        at
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
>        at
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:498)
>        at
> org.apache.geronimo.transaction.manager.TransactionImpl.rollback(TransactionImpl.java:472)
>        at
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.rollback(TransactionManagerImpl.java:250)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:188)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:339)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:336)
>        at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:799)
> Caused by:
> <openjpa-1.0.1-r420667:592145 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: No current
> connection. {INSERT INTO ODE_EVENT (EVENT_ID, DETAIL, DATA, SCOPE_ID,
> TSTAMP, TYPE, INSTANCE_ID, PROCESS_ID) VALUES (?,
>  ?, ?, ?, ?, ?, ?, ?)} [code=40000, state=08003]
>        at
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3938)
>        at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
>        at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:83)
>        at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)
>        at
> org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:75)
>        at
> org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:543)
>        at
> org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:105)
>        at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:89)
>        at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
>        at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:514)
>        at
> org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
>        ... 15 more
>
>
> Any ideas?
>
> Regards,
> Piotr
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message