Kurt Huwig wrote:
Hi Henri,

I had a look at this, but I do not get a deadlock, just an ordinary timeout. As I did not change the deadlock-timeout, there should be deadlock-checking, right?

Am Freitag, 6. Juli 2007 schrieb Henri van de Scheur:
Hi Kurt!

Did you have a look at a page describing debugging lock-situations:
http://wiki.apache.org/db-derby/LockDebugging
Maybe that could help you?

Henri

Kurt Huwig wrote:
Hi there,

I try to debug lock timeouts but am completely clueless. I use these
Derby settings:

        -Dderby.storage.pageCacheSize=2500
        -Dderby.stream.error.logSeverityLevel=0
        -Dderby.locks.waitTimeout=3600
        -Dderby.locks.deadlockTrace=true
        -Dderby.locks.monitor=true

and this for the connections:

        Connection.TRANSACTION_READ_UNCOMMITTED

The application is multi-threaded, multi-connection and using the
Embedded driver. Is there a way to show which statements lock each other?
I suspect that a ResultSet is still open somewhere.

This is from the derby.log:

2007-07-05 04:50:05.196 GMT Thread[SPONTS-278,5,main] (XID = 80082776),
(SESSIONID = 37), (DATABASE = SPONTS), (DRDAID = null), Cleanup action
starting
2007-07-05 04:50:05.196 GMT Thread[SPONTS-278,5,main] (XID = 80082776),
(SESSIONID = 37), (DATABASE = SPONTS), (DRDAID = null), Failed Statement
is: INSERT INTO journal
(id,ip,sender,recipient,mailsender,mailfrom,mailto,cc,bcc,replyto,maildat
e,receiveddate,subject,totallength,attachments,spamscore,status,reason)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?) with 18 parameters [...]
ERROR 40XL1: A lock could not be obtained within the time requested
        at
org.apache.derby.iapi.error.StandardException.newException(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.RowLocking2.lockContainer(Unknown
Source)
        at
org.apache.derby.impl.store.raw.data.BaseContainerHandle.useContainer(Unk
nown Source)
        at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Un
known Source)
        at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Un
known Source)
        at
org.apache.derby.impl.store.raw.xact.Xact.openContainer(Unknown Source)
        at
org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(Unk
nown Source)
        at org.apache.derby.impl.store.access.heap.Heap.open(Unknown
Source) at
org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(Unknow
n Source)
        at
org.apache.derby.impl.store.access.RAMTransaction.openCompiledConglomerat
e(Unknown Source)
        at
org.apache.derby.impl.sql.execute.RowChangerImpl.openForUpdate(Unknown
Source)
        at org.apache.derby.impl.sql.execute.RowChangerImpl.open(Unknown
Source)
        at org.apache.derby.impl.sql.execute.RowChangerImpl.open(Unknown
Source)
        at
org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknow
n Source)
        at org.apache.derby.impl.sql.execute.InsertResultSet.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(Unknow
n Source)
        at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
Source)

2007-07-05 04:51:05.461 GMT Thread[SMTP-out,5,main] (XID = 80083917),
(SESSIONID = 37), (DATABASE = SPONTS), (DRDAID = null), Cleanup action
starting
2007-07-05 04:51:05.461 GMT Thread[SMTP-out,5,main] (XID = 80083917),
(SESSIONID = 37), (DATABASE = SPONTS), (DRDAID = null), Failed Statement
is: SELECT reason FROM journal WHERE id=? with 1 parameters begin
parameter #1: 111394B19A14-0 :end parameter
ERROR 40XL1: A lock could not be obtained within the time requested
        at
org.apache.derby.iapi.error.StandardException.newException(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.RowLocking2.lockContainer(Unknown
Source)
        at
org.apache.derby.impl.store.raw.data.BaseContainerHandle.useContainer(Unk
nown Source)
        at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Un
known Source)
        at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Un
known Source)
        at
org.apache.derby.impl.store.raw.xact.Xact.openContainer(Unknown Source)
        at
org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(Unk
nown Source)
        at org.apache.derby.impl.store.access.heap.Heap.open(Unknown
Source) at
org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(Unknow
n Source)
        at
org.apache.derby.impl.store.access.RAMTransaction.openCompiledConglomerat
e(Unknown Source)
        at
org.apache.derby.impl.store.access.btree.index.B2IForwardScan.init(Unknow
n Source)
        at
org.apache.derby.impl.store.access.btree.index.B2I.openScan(Unknown
Source)
        at
org.apache.derby.impl.store.access.RAMTransaction.openScan(Unknown
Source)
        at
org.apache.derby.impl.store.access.RAMTransaction.openCompiledScan(Unknow
n Source)
        at
org.apache.derby.impl.sql.execute.TableScanResultSet.openScanController(U
nknown Source)
        at
org.apache.derby.impl.sql.execute.TableScanResultSet.openCore(Unknown
Source) at
org.apache.derby.impl.sql.execute.IndexRowToBaseRowResultSet.openCore(Unk
nown Source)
        at
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unkno
wn Source)
        at
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.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(Unknow
n Source)
        at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown
Source)



Hi -
The lock debug property names are misleading. You will be able to get victim/blocker lock information for lock timeouts as well as deadlocks by setting deadlockTrace (I think). Anyway, if you set all of the properties below you will get more information about the lock timeouts than is in the log snippet you posted. Here's the relevant settings from my Development properties file:

# -- 1. Append to the log file rather than overwriting it - manually remove
#  -- the derby.log when it becomes large
derby.infolog.append=true
#  -- 2. Log all errors/messages of any severity (will list deadlocks)
derby.stream.error.logSeverityLevel=0
#  -- . Log all deadlocks
derby.locks.monitor=true
# -- . Writes a stack trace of all threads involved in lock problems
# --  (not just the victims) to the log
derby.locks.deadlockTrace=true



Reply via email to