You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Chatree Srichart <ch...@gmail.com> on 2010/08/04 13:42:25 UTC

[Database Error] A lock could not be obtained within the time requested

I try to insert data to data base about 200 records. But I got some error
message look like database lock problem.

This is the exception:

---- exception report
----------------------------------------------------------
Failure in findOne operation for entity [Product]:
org.ofbiz.entity.GenericDataSourceException: SQL Exception while executing
the following:
...
...
...
--- cause
---------------------------------------------------------------------
Exception: org.apache.derby.iapi.error.StandardException
Message: A lock could not be obtained within the time requested
---- stack trace
---------------------------------------------------------------
ERROR 40XL1: A lock could not be obtained within the time requested
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown
Source)
org.apache.derby.impl.services.locks.AbstractPool.lockObject(Unknown Source)
org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(Unknown
Source)
org.apache.derby.impl.store.raw.xact.RowLocking2.lockRecordForRead(Unknown
Source)
org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
Source)
org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
Source)
org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(Unknown
Source)
org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(Unknown
Source)

Can any one help me what I have to do for fix this?

Regards,
Chatree Srichart

Re: [Database Error] A lock could not be obtained within the time requested

Posted by BJ Freeman <bj...@free-man.net>.
derby is a test db not used for production.
how were you inserting?
what resources on the machine your running ofbiz on
Cpu usage, memory.

Chatree Srichart sent the following on 8/4/2010 4:42 AM:
> I try to insert data to data base about 200 records. But I got some error
> message look like database lock problem.
>
> This is the exception:
>
> ---- exception report
> ----------------------------------------------------------
> Failure in findOne operation for entity [Product]:
> org.ofbiz.entity.GenericDataSourceException: SQL Exception while executing
> the following:
> ...
> ...
> ...
> --- cause
> ---------------------------------------------------------------------
> Exception: org.apache.derby.iapi.error.StandardException
> Message: A lock could not be obtained within the time requested
> ---- stack trace
> ---------------------------------------------------------------
> ERROR 40XL1: A lock could not be obtained within the time requested
> org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
> org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown
> Source)
> org.apache.derby.impl.services.locks.AbstractPool.lockObject(Unknown Source)
> org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(Unknown
> Source)
> org.apache.derby.impl.store.raw.xact.RowLocking2.lockRecordForRead(Unknown
> Source)
> org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> Source)
> org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> Source)
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(Unknown
> Source)
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(Unknown
> Source)
>
> Can any one help me what I have to do for fix this?
>
> Regards,
> Chatree Srichart
>

Re: [Database Error] A lock could not be obtained within the time requested

Posted by Chatree Srichart <ch...@gmail.com>.
Oh I see. I set require-new-transaction="true" at service definition.

Thanks a lot

Regards,
Chatree Srichart

On Thu, Aug 5, 2010 at 3:45 AM, Scott Gray <sc...@hotwaxmedia.com>wrote:

> It generally means you're either doing something to cause a deadlock
> between two transactions or otherwise one transaction is being forced to
> wait too long for another transaction's lock to be released.
> If you're not sure what is causing the problem then you can uncomment the
> debugging lines in derby.properties to see in the logs which
> thread/transaction is blocking and which is left waiting.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 4/08/2010, at 11:42 PM, Chatree Srichart wrote:
>
> > I try to insert data to data base about 200 records. But I got some error
> > message look like database lock problem.
> >
> > This is the exception:
> >
> > ---- exception report
> > ----------------------------------------------------------
> > Failure in findOne operation for entity [Product]:
> > org.ofbiz.entity.GenericDataSourceException: SQL Exception while
> executing
> > the following:
> > ...
> > ...
> > ...
> > --- cause
> > ---------------------------------------------------------------------
> > Exception: org.apache.derby.iapi.error.StandardException
> > Message: A lock could not be obtained within the time requested
> > ---- stack trace
> > ---------------------------------------------------------------
> > ERROR 40XL1: A lock could not be obtained within the time requested
> > org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
> > org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown
> > Source)
> > org.apache.derby.impl.services.locks.AbstractPool.lockObject(Unknown
> Source)
> > org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(Unknown
> > Source)
> >
> org.apache.derby.impl.store.raw.xact.RowLocking2.lockRecordForRead(Unknown
> > Source)
> > org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> > Source)
> > org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> > Source)
> >
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(Unknown
> > Source)
> >
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(Unknown
> > Source)
> >
> > Can any one help me what I have to do for fix this?
> >
> > Regards,
> > Chatree Srichart
>
>

Re: [Database Error] A lock could not be obtained within the time requested

Posted by Scott Gray <sc...@hotwaxmedia.com>.
It generally means you're either doing something to cause a deadlock between two transactions or otherwise one transaction is being forced to wait too long for another transaction's lock to be released.
If you're not sure what is causing the problem then you can uncomment the debugging lines in derby.properties to see in the logs which thread/transaction is blocking and which is left waiting.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 4/08/2010, at 11:42 PM, Chatree Srichart wrote:

> I try to insert data to data base about 200 records. But I got some error
> message look like database lock problem.
> 
> This is the exception:
> 
> ---- exception report
> ----------------------------------------------------------
> Failure in findOne operation for entity [Product]:
> org.ofbiz.entity.GenericDataSourceException: SQL Exception while executing
> the following:
> ...
> ...
> ...
> --- cause
> ---------------------------------------------------------------------
> Exception: org.apache.derby.iapi.error.StandardException
> Message: A lock could not be obtained within the time requested
> ---- stack trace
> ---------------------------------------------------------------
> ERROR 40XL1: A lock could not be obtained within the time requested
> org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
> org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown
> Source)
> org.apache.derby.impl.services.locks.AbstractPool.lockObject(Unknown Source)
> org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(Unknown
> Source)
> org.apache.derby.impl.store.raw.xact.RowLocking2.lockRecordForRead(Unknown
> Source)
> org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> Source)
> org.apache.derby.impl.store.access.heap.HeapController.lockRow(Unknown
> Source)
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(Unknown
> Source)
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(Unknown
> Source)
> 
> Can any one help me what I have to do for fix this?
> 
> Regards,
> Chatree Srichart