On 5/18/07, Adam Bovill <abovill@fnfr.com> wrote:
Well, I cannot attest to forever, but they have been running at 100% for
the last 8 hours.  It happens after repeating these steps for 2-4 hours.


Is there a way to trace all of the actual commands that are sent to the
db?  I can also provide my schema if that helps.  These are two separate
tables, with no foreign keys.

Yes, use can set the derby.language.logStatementText property for that:
http://db.apache.org/derby/docs/dev/tuning/tuning-single.html#rtunproper43517

Thanks,
Adam

-----Original Message-----
From: Mike Matrigali [mailto:mikem_app@sbcglobal.net]
Sent: Friday, May 18, 2007 3:29 PM
To: Derby Discussion
Subject: Re: Embedded thread taking 100% cpu

are you saying that if you stop your loop and do nothing then you
see the cpu spinning at 100% "forever".

The stack traces are what I would expect, and they may spin for
100% cpu for a short time depending on size of table and cache size
as they may require no I/O.  Anytime you delete all rows from a page
as it seems your step 4 does, then work is queued to be activated when
that transaction commits.  At step 5 the work is processed, it basically
reclaims the space freed by the committed deletes and makes it available
for future inserts into the table.

Adam Bovill wrote:
> Hello,
>
> I seem to be having a problem with my embedded derby
> "derby.rawStoreDeamon" thread where it takes up 100% of my CPU.
> Everything else is still responsive, but this thread seems to be
looping
> through the following stack traces.  Also, as soon as I make any
> additional action on the Database, it returns to normal, so it seems
> that I have done something to get it into a strange state.
>
> The following stack traces were taken by halting that thread multiple
> times, they are not in any order.
>
> So this happens after repeating the following multiple times:
>
>
>
> 1. Add items to two tables. (3 items into one, 15 into the other)
>
> 2. Set autocommit = false
>
> 3. force commit
>
> 4. attempt to delete all the items (and they are successfully deleted)
>
> 5. force commit
>
> 6. set autocommit = true
>
>
>
> I set the autocommit to false so that I can roll back the changes if
the
> delete fails.
>
>
>
> It seems to just sit there and spin doing nothing.  Have I done
> something wrong with my commit logic?
>
>
>
> Thanks,
>
> Adam
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             LockControl.addLock(LockSet, Object, Object) line: not
> available
>
>             LockSet.lockObject(Object, Lockable, Object, int, Latch)
> line: not available
>
>             SinglePool.lockAnObject (Object, Object, Lockable, Object,
> int, Latch) line: not available
>
>             SinglePool.lockObject(Object, Object, Lockable, Object,
int)
> line: not available
>
>             ContainerLocking3.lockContainer(Transaction,
> ContainerHandle, boolean, boolean) line: not available
>
>             BaseContainerHandle.useContainer(boolean, boolean) line:
not
> available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int, boolean) line: not available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int) line: not available
>
>             InternalXact(Xact).openContainer(ContainerKey,
> LockingPolicy, int) line: not available
>
>             OpenHeap(OpenConglomerate).init(ContainerHandle,
> Conglomerate, int[], TransactionManager, Transaction, boolean, int,
int,
> LockingPolicy, DynamicCompiledOpenConglomInfo) line: not available
>
>             Heap.open(TransactionManager, Transaction, boolean, int,
> int, LockingPolicy, StaticCompiledOpenConglomInfo,
> DynamicCompiledOpenConglomInfo) line: not available
>
>             RAMTransaction.openConglomerate(Conglomerate, boolean,
int,
> int, int, StaticCompiledOpenConglomInfo,
DynamicCompiledOpenConglomInfo)
> line: not available
>
>             RAMTransaction.openConglomerate(long, boolean, int, int,
> int) line: not available
>
>             B2I.lockTable (TransactionManager, int, int, int) line: not

> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient (ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run () line: not available
>
>
>
>
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             OpenHeap(OpenConglomerate).init(ContainerHandle,
> Conglomerate, int[], TransactionManager, Transaction, boolean, int,
int,
> LockingPolicy, DynamicCompiledOpenConglomInfo) line: not available
>
>             Heap.open(TransactionManager, Transaction, boolean, int,
> int, LockingPolicy, StaticCompiledOpenConglomInfo,
> DynamicCompiledOpenConglomInfo) line: not available
>
>             RAMTransaction.openConglomerate(Conglomerate, boolean,
int,
> int, int, StaticCompiledOpenConglomInfo,
DynamicCompiledOpenConglomInfo)
> line: not available
>
>             RAMTransaction.openConglomerate(long, boolean, int, int,
> int) line: not available
>
>             B2I.lockTable (TransactionManager, int, int, int) line: not

> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient (ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run () line: not available
>
>
>
>
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             BaseContainerHandle.useContainer(boolean, boolean) line:
not
> available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int, boolean) line: not available
>
>             BaseDataFileFactory.openContainer (RawTransaction,
> ContainerKey, LockingPolicy, int) line: not available
>
>             InternalXact(Xact).openContainer(ContainerKey,
> LockingPolicy, int) line: not available
>
>             OpenHeap(OpenConglomerate).init(ContainerHandle,
> Conglomerate, int[], TransactionManager, Transaction, boolean, int,
int,
> LockingPolicy, DynamicCompiledOpenConglomInfo) line: not available
>
>             Heap.open(TransactionManager, Transaction, boolean, int,
> int, LockingPolicy, StaticCompiledOpenConglomInfo,
> DynamicCompiledOpenConglomInfo) line: not available
>
>             RAMTransaction.openConglomerate(Conglomerate, boolean,
int,
> int, int, StaticCompiledOpenConglomInfo,
DynamicCompiledOpenConglomInfo)
> line: not available
>
>             RAMTransaction.openConglomerate(long, boolean, int, int,
> int) line: not available
>
>             B2I.lockTable (TransactionManager, int, int, int) line: not

> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient (ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run () line: not available
>
>
>
>
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             LinkedList<E>.addBefore(E, Entry<E>) line: not available
>
>             LinkedList<E>.add(E) line: not available
>
>             LockControl.addWaiter(List, Lock, LockSet) line: not
> available
>
>             LockControl.addLock (LockSet, Object, Object) line: not
> available
>
>             LockSet.lockObject(Object, Lockable, Object, int, Latch)
> line: not available
>
>             SinglePool.lockAnObject(Object, Object, Lockable, Object,
> int, Latch) line: not available
>
>             SinglePool.lockObject(Object, Object, Lockable, Object,
int)
> line: not available
>
>             ContainerLocking3.lockContainer(Transaction,
> ContainerHandle, boolean, boolean) line: not available
>
>             BaseContainerHandle.useContainer(boolean, boolean) line:
not
> available
>
>             BaseDataFileFactory.openContainer (RawTransaction,
> ContainerKey, LockingPolicy, int, boolean) line: not available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int) line: not available
>
>             InternalXact(Xact).openContainer(ContainerKey,
> LockingPolicy, int) line: not available
>
>             OpenHeap(OpenConglomerate).init(ContainerHandle,
> Conglomerate, int[], TransactionManager, Transaction, boolean, int,
int,
> LockingPolicy, DynamicCompiledOpenConglomInfo) line: not available
>
>             Heap.open(TransactionManager, Transaction, boolean, int,
> int, LockingPolicy, StaticCompiledOpenConglomInfo,
> DynamicCompiledOpenConglomInfo) line: not available
>
>             RAMTransaction.openConglomerate(Conglomerate, boolean,
int,
> int, int, StaticCompiledOpenConglomInfo,
DynamicCompiledOpenConglomInfo)
> line: not available
>
>             RAMTransaction.openConglomerate(long, boolean, int, int,
> int) line: not available
>
>             B2I.lockTable(TransactionManager, int, int, int) line: not

> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient(ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run() line: not available
>
>
>
>
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             Thread.setPriority0(int) line: not available [native
method]
>
>             Thread.setPriority (int) line: not available
>
>             FileMonitor(BaseMonitor).setThreadPriority(int) line: not
> available
>
>             FileMonitor.run() line: not available
>
>
AccessController.doPrivileged (PrivilegedExceptionAction<T>)
> line: not available [native method]
>
>             FileMonitor.setThreadPriority(int) line: not
> available
>
>             BasicDaemon.yield() line: not available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run() line: not available
>
>
>
>
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             TransactionTable.add(Xact, boolean) line: not available

>
>             XactFactory.add (Xact, boolean) line: not available
>
>             XactFactory.pushTransactionContext(ContextManager, String,

> Xact, boolean, RawStoreFactory, boolean) line: not available

>
>             XactFactory.startInternalTransaction(RawStoreFactory,
> ContextManager) line: not available
>
>             RawStore.startInternalTransaction(ContextManager) line:
not
> available
>
>             RAMTransaction.getInternalTransaction() line: not
> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient (ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run () line: not available
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             BaseContainerHandle.useContainer(boolean, boolean) line:
not
> available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int, boolean) line: not available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int) line: not available
>
>             InternalXact(Xact).openContainer(ContainerKey,
> LockingPolicy, int) line: not available
>
>             OpenHeap(OpenConglomerate).init(ContainerHandle,
> Conglomerate, int[], TransactionManager, Transaction, boolean, int,
int,
> LockingPolicy, DynamicCompiledOpenConglomInfo) line: not available
>
>             Heap.open(TransactionManager, Transaction, boolean, int,
> int, LockingPolicy, StaticCompiledOpenConglomInfo,
> DynamicCompiledOpenConglomInfo) line: not available
>
>             RAMTransaction.openConglomerate(Conglomerate, boolean,
int,
> int, int, StaticCompiledOpenConglomInfo,
DynamicCompiledOpenConglomInfo)
> line: not available
>
>             RAMTransaction.openConglomerate(long, boolean, int, int,
> int) line: not available
>
>             B2I.lockTable (TransactionManager, int, int, int) line: not

> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient (ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run () line: not available
>
>
>
>
>
>
>
>
>
> Thread [derby.rawStoreDaemon] (Suspended)
>
>             LinkedList<E>.remove(Entry<E>) line: not available

>
>             LinkedList<E>.remove(Object) line: not available
>
>             LockControl.removeWaiter(List, Object, LockSet) line: not
> available
>
>             LockControl.giveUpWait (Object, LockSet) line: not
> available
>
>             LockSet.lockObject(Object, Lockable, Object, int, Latch)
> line: not available
>
>             SinglePool.lockAnObject(Object, Object, Lockable, Object,
> int, Latch) line: not available
>
>             SinglePool.lockObject(Object, Object, Lockable, Object,
int)
> line: not available
>
>             ContainerLocking3.lockContainer(Transaction,
> ContainerHandle, boolean, boolean) line: not available
>
>             BaseContainerHandle.useContainer(boolean, boolean) line:
not
> available
>
>             BaseDataFileFactory.openContainer (RawTransaction,
> ContainerKey, LockingPolicy, int, boolean) line: not available
>
>             BaseDataFileFactory.openContainer(RawTransaction,
> ContainerKey, LockingPolicy, int) line: not available
>
>             InternalXact(Xact).openContainer(ContainerKey,
> LockingPolicy, int) line: not available
>
>             OpenHeap(OpenConglomerate).init(ContainerHandle,
> Conglomerate, int[], TransactionManager, Transaction, boolean, int,
int,
> LockingPolicy, DynamicCompiledOpenConglomInfo) line: not available
>
>             Heap.open(TransactionManager, Transaction, boolean, int,
> int, LockingPolicy, StaticCompiledOpenConglomInfo,
> DynamicCompiledOpenConglomInfo) line: not available
>
>             RAMTransaction.openConglomerate(Conglomerate, boolean,
int,
> int, int, StaticCompiledOpenConglomInfo,
DynamicCompiledOpenConglomInfo)
> line: not available
>
>             RAMTransaction.openConglomerate(long, boolean, int, int,
> int) line: not available
>
>             B2I.lockTable(TransactionManager, int, int, int) line: not

> available
>
>             BTreePostCommit.performWork(ContextManager) line: not
> available
>
>             BasicDaemon.serviceClient(ServiceRecord) line: not
> available
>
>             BasicDaemon.work(boolean) line: not available
>
>             BasicDaemon.run() line: not available
>
>             Thread.run() line: not available
>