You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Geoff hendrey <ge...@yahoo.com> on 2008/05/18 04:04:29 UTC

Derby Stack Overflow releated to deadlock

(Sorry, I forgot to put a Subject on my last email. Here it is again, with a Subject)
Hi,

I am having another issue with deadlocks. I put this in derby.properties to get more information:
derby.locks.monitor=true
derby.locks.deadlockTrace=true
derby.locks.deadlockTimeout=1
derby.locks.waitTimeout=1
derby.storage.pageCacheSize=40


But
then I see this StackOverflowError in derby.log. Anyone know what the
problem is? The stack trace below goes on and on and on (I truncated
it). Looks like Derby is stuck in a recursive call, then the stack
overflows.

2008-05-17 23:38:37.013 GMT:
 Booting
Derby version The Apache Software Foundation - Apache Derby - 10.3.2.2
- (618335): instance 80220011-0119-f93f-b912-00000000bced
on database directory /db/domains/geoff  

Database Class Loader started - derby.database.classpath=''
2008-05-17 23:44:36.380
GMT Thread[btpool0-2,5,main] (XID = 7556), (SESSIONID = 4), (DATABASE =
domains/geoff), (DRDAID = null), Cleanup action starting
java.lang.StackOverflowError
        at org.apache.derby.impl.sql.execute.GenericExecutionFactory.getValueRow(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SYSCONGLOMERATESRowFactory.makeRow(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SYSCONGLOMERATESRowFactory.makeEmptyRow(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.hashAllConglomerateDescriptorsByNumber(Unknown Source)
        at org.apache.derby.impl.services.locks.TableNameInfo.<init>(Unknown Source)
        at org.apache.derby.impl.services.locks.Timeout.buildLockTableString(Unknown Source)
        at org.apache.derby.impl.services.locks.Timeout.createException(Unknown Source)
        at org.apache.derby.impl.services.locks.Timeout.buildException(Unknown Source)
        at org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown Source)
        at org.apache.derby.impl.services.locks.AbstractPool.lockObject(Unknown Source)
        at org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.RowLocking3.lockRecordForRead(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.next(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SYSTABLESRowFactory.buildDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.hashAllTableDescriptorsByTableId(Unknown Source)
        at org.apache.derby.impl.services.locks.TableNameInfo.<init>(Unknown Source)
        at org.apache.derby.impl.services.locks.Timeout.buildLockTableString(Unknown Source)
        at org.apache.derby.impl.services.locks.Timeout.createException(Unknown Source)
        at org.apache.derby.impl.services.locks.Timeout.buildException(Unknown Source)
        at org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown Source)
        at org.apache.derby.impl.services.locks.AbstractPool.lockObject(Unknown Source)
        at org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.RowLocking3.lockRecordForRead(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.next(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SYSTABLESRowFactory.buildDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.hashAllTableDescriptorsByTableId(Unknown Source)

Re: Derby Stack Overflow releated to deadlock

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> But then I see this StackOverflowError in derby.log. Anyone know what 
> the problem is? The stack trace below goes on and on and on (I truncated 
> it). Looks like Derby is stuck in a recursive call, then the stack 
> overflows.

Hi Geoff, thanks for the detailed information from the stack traces.

It seems to me that you have two separate but related problems:

1) You're getting a deadlock that involves the system catalog SYSTABLES.
I'm not sure why this is happening to you, but I haven't heard of this
problem before so there must be something unique about your application
which is triggering this. Can you try to narrow down the access pattern
which is causing this deadlock?

2) When the deadlock happens, the lock table tracing logic that is run
by derby.locks.deadlockTrace is itself encountering the same lock
problem, only that code has a bug and as you say you get stuck in an
infinite recursion:
  - got a deadlock, which causes
    - deadlockTrace code to run, which
      - get a deadlock, which causes
        - deadlockTrace code to run, which
          - get a deadlock, which causes ...
and so forth.

The second problem seems like an out-and-out bug in the deadlockTrace
feature; can you please capture as much information (stack trace, derby.log,
sysinfo, etc.) and open an entry in JIRA?

The first problem seems like it should be something you can avoid, if
we can figure out what the access pattern is which is causing you to
get a SYSTABLES-related deadlock.

thanks,

bryan