[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Another thread runs exclusively already." exception



    What would cause this exception to be thrown?

    I am running a test query that starts a thread, queries the db for a
user. I start some number of these threads, based on a command line
argument.  It seems that at a certian point, the exception is thrown.
The number of queries started varies from execution to execution.

    This is thrown from the beginExclusion method.

    From a short overview of the code (about five minutes, so please
forgive me if I'm overlooking something), it would apear that a
Transaction object does not have it's own thread instace variable, and
that upon starting a Transcation via
TransactionManager.prepareTransaction() that two threads could collide
on the single TransactionManager.exclusive attribute.  Shouldn't either
the Transaction class have it's own thread attribute for syncing on, or
make TransactionManager.prepareTransaction() a synchronized method to
prevent two threads from changeing the TransactionManager.exclusive
attribute?

    It would appear that the later would - in effect - make the db
single threaded by means of only single access, so perhaps giving each
Transaction an attribute would be better.

    Am I missing something from only looking at this one class?  The
terminal output from Ozone set to debug3 is as follows.  Thanks for any
advice.


--snip--
[info] (951) InvokeServer: connection established...
[debug](711) InvokeServer: handleClientEvent()...
[info] (711) InvokeServer: user logged in: treaves
[debug](711) InvokeServer: handleClientEvent()...
[debug](711) ClassManager: dropClasses()
[debug](583) InvokeServer: handleClientEvent()...
[info] (583) InvokeServer: user logged in: treaves
[debug](583) InvokeServer: handleClientEvent()...
[debug](583) TransactionManager: handleCommand(): [DbInvoke: 17]
[debug](583) TransactionManager: completeTransaction(): [DbInvoke: 17]
[debug](583) TransactionManager: newTransaction()
*****************************
[debug](583) TransactionManager: performCommand(): ta(-119), [DbInvoke:
17]
[debug](583) Transaction: performCommand(): ta(-119), [DbInvoke: 17]
[debug](583) Transaction: invokeObject(): 17
[debug](583) DefaultLock: tryAcquire(): current:0 new:1
[debug](583) WizardStore: updateLockLevel()
[debug](583) Cluster: updateLockLevel(): 1010
[debug](583) Cluster:     lock: 1
[debug](583) TransactionManager: prepareTransaction()
[debug](583) TransactionManager: beginExclusion():
[debug](711) InvokeServer: handleClientEvent()...
[debug](711) TransactionManager: handleCommand(): [DbObjForName]
[debug](711) TransactionManager: completeTransaction(): [DbObjForName]
[debug](711) TransactionManager: newTransaction()
*****************************
[debug](711) TransactionManager: performCommand(): ta(-117),
[DbObjForName]
[debug](711) Transaction: performCommand(): ta(-117), [DbObjForName]
[debug](711) TransactionManager: prepareTransaction()
[warn] (711) TransactionManager: Prepare transaction failed: ta(-117);
aborting...
    java.lang.RuntimeException: Another thread runs exclusively already.

        at java.lang.Throwable.<init>(Throwable.java:96)
        at java.lang.Exception.<init>(Exception.java:44)
        at java.lang.RuntimeException.<init>(RuntimeException.java:49)
        at
org.ozoneDB.core.TransactionManager.beginExclusion(TransactionMana
            ger.java:475)
        at
org.ozoneDB.core.TransactionManager.prepareTransaction(Transaction
            Manager.java:385)
        at
org.ozoneDB.core.TransactionManager.completeTransaction(Transactio
            nManager.java:278)
        at
org.ozoneDB.core.TransactionManager.handleCommand(TransactionManag
            er.java:196)
        at
org.ozoneDB.core.InvokeServer.handleClientEvent(InvokeServer.java:
            77)
        at
org.ozoneDB.DxLib.net.DxMultiServerClient.run(DxMultiServerClient.
            java:37)
        at java.lang.Thread.run(Thread.java:498)
[debug](711) TransactionManager: abortTransaction()
[warn] (711) TransactionManager: Aborting transaction failed: ta(-117)
[debug](583) Transaction: ==> PREPARECOMMIT()
[debug](583) WizardStore: prepareCommitTransaction()
[debug](583) WizardStore: prepare commit cluster: 1010
[debug](583) ClusterStore: prepareCommitCluster(): 1010
[debug](583) Cluster: prepareCommit()1010
[debug](583) TransactionManager: endExclusion():
[debug](583) TransactionManager: commitTransaction()
[debug](583) TransactionManager: beginExclusion():
[debug](583) Transaction: ==> COMMIT()
[debug](583) WizardStore: commitTransaction()
[debug](583) WizardStore: commit cluster: 1010
[debug](583) ClusterStore: commitCluster(): 1010
[debug](583) Cluster: commit()1010
[debug](583) DefaultLock: release()
[debug](583) WizardStore:     idTable.count(): 3
[debug](583) WizardStore:     nameTable.count(): 1
[debug](583) TransactionManager: endExclusion():
[debug](583) TransactionManager: notifyWaitingTransactions()
[debug](583) TransactionManager: deleteTransaction()
--------------------------
[debug](583) TransactionManager:     invoke count:1
    java.lang.RuntimeException: Another thread runs exclusively already.

        at java.lang.Throwable.<init>(Throwable.java:96)
        at java.lang.Exception.<init>(Exception.java:44)
        at java.lang.RuntimeException.<init>(RuntimeException.java:49)
        at
org.ozoneDB.core.TransactionManager.beginExclusion(TransactionMana
            ger.java:475)
        at
org.ozoneDB.core.TransactionManager.abortTransaction(TransactionMa
             nager.java:454)
        at
org.ozoneDB.core.TransactionManager.prepareTransaction(Transaction
            Manager.java:391)
        at
org.ozoneDB.core.TransactionManager.completeTransaction(Transactio
            nManager.java:278)
        at
org.ozoneDB.core.TransactionManager.handleCommand(TransactionManag
            er.java:196)
        at
org.ozoneDB.core.InvokeServer.handleClientEvent(InvokeServer.java:
            77)
        at
org.ozoneDB.DxLib.net.DxMultiServerClient.run(DxMultiServerClient.
            java:37)
        at java.lang.Thread.run(Thread.java:498)
[debug](711) TransactionManager: endExclusion():
[debug](711) TransactionManager: endExclusion():
[debug](711) TransactionManager: deleteTransaction()
--------------------------
[debug](711) TransactionManager:     invoke count:0
[debug](895) InvokeServer: close connection...
[debug](895) InvokeServer: close pending transaction...
[debug](895) TransactionManager: handleCommand(): [DbCloseConn]
[info] (895) InvokeServer: connection closed (user: treaves)
[debug](567) InvokeServer: close connection...
[debug](567) InvokeServer: close pending transaction...
[debug](567) TransactionManager: handleCommand(): [DbCloseConn]
[info] (567) InvokeServer: connection closed (user: treaves)
[debug](583) InvokeServer: close connection...
[debug](583) InvokeServer: close pending transaction...
[debug](583) TransactionManager: handleCommand(): [DbCloseConn]
[info] (583) InvokeServer: connection closed (user: treaves)
[debug](623) InvokeServer: close connection...
[debug](623) InvokeServer: close pending transaction...
[debug](623) TransactionManager: handleCommand(): [DbCloseConn]
[info] (623) InvokeServer: connection closed (user: treaves)
[debug](751) InvokeServer: close connection...
[debug](751) InvokeServer: close pending transaction...
[debug](751) TransactionManager: handleCommand(): [DbCloseConn]
[info] (751) InvokeServer: connection closed (user: treaves)
[debug](463) InvokeServer: close connection...
[debug](463) InvokeServer: close pending transaction...
[debug](463) TransactionManager: handleCommand(): [DbCloseConn]
[info] (463) InvokeServer: connection closed (user: treaves)
[debug](767) InvokeServer: close connection...
[debug](767) InvokeServer: close pending transaction...
[debug](767) TransactionManager: handleCommand(): [DbCloseConn]
[info] (767) InvokeServer: connection closed (user: treaves)

--snip--