LockTimeoutException

Hi,
I am getting this weird Exception sometimes:
Do Dez 05 17:31:12 GMT+01:00 2002:<I> <EJB JAR deployment ./myserver/serverclasses/ejb_de_gerling_ecommerce_common_datamanager.jar>
Transaction: '1038912297829_658666' rolled back due to EJB exception:
weblogic.ejb.extensions.LockTimedOutException: Lock for primaryKey:1038912310933_9491
could not be acquired without waiting.
at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java(Compiled
Code))
at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java(Compiled
Code))
at weblogic.ejb.internal.StatefulEJBCache.bind(StatefulEJBCache.java(Compiled
Code))
at weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java(Compiled
Code))
at weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java(Compiled
Code))
at de.gerling.ecommerce.common.datamanager.DataManagerBeanEOImpl.getDataAsMap(DataManagerBeanEOImpl.java(Compiled
Code))
at de.gerling.ecommerce.common.datamanager.DataManagerWrapperImpl.getDataAsMap(DataManagerWrapperImpl.java(Compiled
Code))
at de.gerling.ecommerce.mandantentool.PUserManager.getPUser(PUserManager.java(Compiled
Code))
at de.gerling.ecommerce.taglibs.USERGetValue.doStartTag(USERGetValue.java(Compiled
Code))
at ecommerce.jsp._Mandant._javascript._globalstuff_v1_1._jspService(_globalstuff_v1_1.java(Compiled
Code))
at weblogic.servlet.jsp.JspBase.service(JspBase.java(Compiled Code))
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java(Compiled
Code))
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java(Compiled
Code))
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java(Compiled
Code))
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)
The only class of mine in question is DataManager which is a stateful session
bean. The getPUser-Method accesses the Datamanager to get an instance which is
stored in the Datamanager (getDataAsMap).
Why do I get this Exception at all. Sometimes I get several in a Minute, sometime
I get none for hours.
Please help!

Goetz Markgraf wrote:
Hi Rob.
I guess, a sfsb is a stateful sessionbean. It might be.Sorry, yes I meant sfsb = stateful session bean.
We have not yet reconstructed
the cases in which the error occurs. But the Bean might be called by multiple
threads, Indeed, that would explain it. In general stateful session beans should
be used as 1 client = 1 sfsb instance. By default, WLS will throw a
RemoteException if the sfsb is called concurrently by multiple threads.
There is a flag <allow-concurrent-calls> in the weblogic-ejb-jar.xml
that can be enabled. When set, the container does not complain when
concurrent client threads call the sfsb. It implements locking around
the sfsb so the concurrent caller waits for the current call to complete.
-- Rob
if the user opens more than one browser and starts multiple requests.
Another possible reason could be a frameset where the browser opens more than
one connection to the server. I trust that this cannot be avoided. How do I avoid
the error?
Thanx, Goetz
Rob Woollen <[email protected]> wrote:
Is this sfsb ever called concurrently by multiple threads?
-- Rob
Goetz Markgraf wrote:
Hi,
I am getting this weird Exception sometimes:
Do Dez 05 17:31:12 GMT+01:00 2002:<I> <EJB JAR deployment ./myserver/serverclasses/ejb_de_gerling_ecommerce_common_datamanager.jar>
Transaction: '1038912297829_658666' rolled back due to EJB exception:
weblogic.ejb.extensions.LockTimedOutException: Lock for primaryKey:1038912310933_9491
could not be acquired without waiting.
at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java(Compiled
Code))
at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java(Compiled
Code))
at weblogic.ejb.internal.StatefulEJBCache.bind(StatefulEJBCache.java(Compiled
Code))
at weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java(Compiled
Code))
at weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java(Compiled
Code))
at de.gerling.ecommerce.common.datamanager.DataManagerBeanEOImpl.getDataAsMap(DataManagerBeanEOImpl.java(Compiled
Code))
at de.gerling.ecommerce.common.datamanager.DataManagerWrapperImpl.getDataAsMap(DataManagerWrapperImpl.java(Compiled
Code))
at de.gerling.ecommerce.mandantentool.PUserManager.getPUser(PUserManager.java(Compiled
Code))
at de.gerling.ecommerce.taglibs.USERGetValue.doStartTag(USERGetValue.java(Compiled
Code))
at ecommerce.jsp._Mandant._javascript._globalstuff_v1_1._jspService(_globalstuff_v1_1.java(Compiled
Code))
at weblogic.servlet.jsp.JspBase.service(JspBase.java(CompiledCode))
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java(Compiled
Code))
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java(Compiled
Code))
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java(Compiled
Code))
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)
The only class of mine in question is DataManager which is a statefulsession
bean. The getPUser-Method accesses the Datamanager to get an instancewhich is
stored in the Datamanager (getDataAsMap).
Why do I get this Exception at all. Sometimes I get several in a Minute,sometime
I get none for hours.
Please help!

Similar Messages

  • Weblogic.ejb.extensions.LockTimeOutException HELP!

    Hi,
    We're seeing weblogic.ejb.extensions.LockTimeOutException when we try
    to access some Entity Bean's data member. I'm wondering someone could
    help us?
    There is some background:
    WL server 5.1, SP10 (almost sure:)
    Running in Solaris w/ Oracle 8i
    The sequence of calls is:
    IWorkspaceRemote workspace = (IWorkspaceRemote)
    getEntityBean(EJBConstants.JNDI_NAME_WORKSPACE, new
    Long(workspaceID));
    WorkspaceDetailData wsData = workspace.getWorkspaceDetailData();
    ( the EJB home is cached in memory ***)
    Inside ejbLoad() we're using the Composite Entity EJB pattern (for
    lazy loading) and looks something like this:
    void ejbLoad() {
    m_baseData = loadBaseData();
    if (m_detailData != null) {
    m_detailData = loadDetailData();
    DetailData getWorkspaceDetailData() {
    if (m_detailData == null) {
    m_detailData = loadDetailData();
    THe stack trace I get is:
    weblogic.ejb.extensions.LockTimedOutException: Lock for
    primaryKey:21071 timed out after 60000 ms.
    at weblogic.ejb.internal.LockManagerImpl.waitForLock(LockManagerImpl.java:53)
    at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java:146)
    at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java:81)
    at weblogic.ejb.internal.StatefulEJBCache.bind(StatefulEJBCache.java:456)
    at weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java:162)
    at weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:476)
    at com.intralinks.wsadmin.entity.WorkspaceBeanEOImpl.getWorkspaceDetailData(WorkspaceBeanEOImpl.java:155)
    at com.intralinks.util.IntralinksServlet.setWorkspaceIDNoEventLogging(Unknown
    Source)
    at com.intralinks.util.IntralinksServlet.setWorkspaceID(Unknown
    Source)
    at com.intralinks.servlets.html.workspaces.EnterWorkspaceServlet.process(Unknown
    Source)
    Any ideas?
    Thanks,
    - Roberto

    Hi Roberto,
    Check CP, data sources (if they are available in 5.1) etc for oracle instance
    parameters like servers, user ids, passwords, urls etc.
    S
    [email protected] (Roberto) wrote:
    Hi,
    We're seeing weblogic.ejb.extensions.LockTimeOutException when we try
    to access some Entity Bean's data member. I'm wondering someone could
    help us?
    There is some background:
    WL server 5.1, SP10 (almost sure:)
    Running in Solaris w/ Oracle 8i
    The sequence of calls is:
    IWorkspaceRemote workspace = (IWorkspaceRemote)
    getEntityBean(EJBConstants.JNDI_NAME_WORKSPACE, new
    Long(workspaceID));
    WorkspaceDetailData wsData = workspace.getWorkspaceDetailData();
    ( the EJB home is cached in memory ***)
    Inside ejbLoad() we're using the Composite Entity EJB pattern (for
    lazy loading) and looks something like this:
    void ejbLoad() {
    m_baseData = loadBaseData();
    if (m_detailData != null) {
    m_detailData = loadDetailData();
    DetailData getWorkspaceDetailData() {
    if (m_detailData == null) {
    m_detailData = loadDetailData();
    THe stack trace I get is:
    weblogic.ejb.extensions.LockTimedOutException: Lock for
    primaryKey:21071 timed out after 60000 ms.
    at weblogic.ejb.internal.LockManagerImpl.waitForLock(LockManagerImpl.java:53)
    at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java:146)
    at weblogic.ejb.internal.LockManagerImpl.lock(LockManagerImpl.java:81)
    at weblogic.ejb.internal.StatefulEJBCache.bind(StatefulEJBCache.java:456)
    at weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java:162)
    at weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:476)
    at com.intralinks.wsadmin.entity.WorkspaceBeanEOImpl.getWorkspaceDetailData(WorkspaceBeanEOImpl.java:155)
    at com.intralinks.util.IntralinksServlet.setWorkspaceIDNoEventLogging(Unknown
    Source)
    at com.intralinks.util.IntralinksServlet.setWorkspaceID(Unknown
    Source)
    at com.intralinks.servlets.html.workspaces.EnterWorkspaceServlet.process(Unknown
    Source)
    Any ideas?
    Thanks,
    - Roberto

  • Intermittent Lock Timeout Exceptions with JE 5.0.58

    Hi,
    During tests, the system continues to experience Lock Timeout problems from time to time, even with the latest version 5.0.58. The collection contains data which is typically removed shortly after inserted, so records usually have a short lifetime. There are multiple writer threads and 1 delete / reader thread.
    Any tips? Note the timeout is already a healthy 3 minutes long, so I don't think that's the problem. Stack trace and details below.
    Maybe the best thing to do is to reduce the lock timeout in order to not block the data pipeline, if a simple retry fixes it?
    Thanks,
    Karl
    ERROR@00:08:03 com.sleepycat.je.LockTimeoutException: (JE 5.0.58) Lock expired. Locker 879535510 -1_dbreader--Thread-5_ThreadLocker: waited for lock on database=persist#ListenerStore#com.procon.data.msg.local.BerkeleyDBMessage LockAddr:
    892328566 LSN=0xffffffff/0x5882af type=READ grant=WAIT_NEW timeoutMillis=180000 startTime=1344323103818 endTime=1344323283850
    Owners: [<LockInfo locker="1242902705 -1_CAL-dbwriter--Thread-18_ThreadLocker" type="WRITE"/>]
    Waiters: []
    com.sleepycat.je.txn.LockManager.newLockTimeoutException(LockManager.java:664)
    com.sleepycat.je.txn.LockManager.makeTimeoutMsgInternal(LockManager.java:623)
    com.sleepycat.je.txn.SyncedLockManager.makeTimeoutMsg(SyncedLockManager.java:97)
    com.sleepycat.je.txn.LockManager.lockInternal(LockManager.java:390)
    com.sleepycat.je.txn.LockManager.lock(LockManager.java:276)
    com.sleepycat.je.txn.BasicLocker.lockInternal(BasicLocker.java:118)
    com.sleepycat.je.txn.Locker.lock(Locker.java:443)
    com.sleepycat.je.dbi.CursorImpl.lockLN(CursorImpl.java:2589)
    com.sleepycat.je.dbi.CursorImpl.lockLN(CursorImpl.java:2390)
    com.sleepycat.je.dbi.CursorImpl.searchAndPosition(CursorImpl.java:2118)
    com.sleepycat.je.Cursor.searchInternal(Cursor.java:2666)
    com.sleepycat.je.Cursor.searchAllowPhantoms(Cursor.java:2576)
    com.sleepycat.je.Cursor.searchNoDups(Cursor.java:2430)
    com.sleepycat.je.Cursor.search(Cursor.java:2397)
    com.sleepycat.je.Cursor.readPrimaryAfterGet(Cursor.java:3703)
    com.sleepycat.je.SecondaryCursor.readPrimaryAfterGet(SecondaryCursor.java:1470)
    com.sleepycat.je.SecondaryCursor.retrieveNext(SecondaryCursor.java:1448)
    com.sleepycat.je.SecondaryCursor.getNext(SecondaryCursor.java:560)
    com.sleepycat.util.keyrange.RangeCursor.doGetNext(RangeCursor.java:897)
    com.sleepycat.util.keyrange.RangeCursor.getNext(RangeCursor.java:451)
    com.sleepycat.persist.BasicCursor.next(BasicCursor.java:80)
    com.sleepycat.persist.BasicIterator.hasNext(BasicIterator.java:49)
    com.procon.data.msg.local.BerkeleyDBMessageStore.queryMessages(BerkeleyDBMessageStore.java:498)
    com.procon.listener.DatabaseReader.runMain(DatabaseReader.java:161)
    com.procon.base.BasicRunnable.run(BasicRunnable.java:274)
    java.lang.Thread.run(Thread.java:662)

    Karl,
    With a 3 minute timeout, you may have a true deadlock (which are sometimes expected) or a bug in your app where you neglect to close a cursor or close a transaction. Increasing the lock timeout is usually not the solution, but the first step is to diagnose what is causing it, and you haven't given us enough information to do that. You haven't said what isolation modes you're using, what transactions are active, how many records are involved in each transactions, etc.
    I suggest that you read:
    http://docs.oracle.com/cd/E17277_02/html/TransactionGettingStarted/index.html
    in particular the Concurrency chapter.
    Also see:
    http://www.oracle.com/technetwork/database/berkeleydb/je-faq-096044.html#HowdoIdebugalocktimeout
    for how to get more information about this particular lock conflict.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Too many locks

    Hello everyone,
    We are using Berkeley DB Java Edition with our heavily-multithreaded application. Transactions have been enabled on the database.
    While the system is busy, we occasionally face an orgy of LockTimeoutException, which can be resolved only by a restart. Note that the locks also usually prevent a clean close of the database/environment.
    One such sample is:
    com.sleepycat.je.LockTimeoutException: (JE 4.1.17) Lock expired. Locker 1668415747 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970960_ReadCommittedLocker: waited for lock on database=sampleDatabase LockAddr:292555378 node=8759642048 type=READ grant=WAIT_NEW timeoutMillis=30000 startTime=1327243343323 endTime=1327243373324 Owners: [<LockInfo locker="1542681801 610308237201_TH_CGTOutCylSMS5 for gOutMsgID 96970930_Txn" type="WRITE"/>]
    Waiters: [<LockInfo locker="711907833 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970946_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1403551794 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970940_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1369480950 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970957_ReadCommittedLocker" type="READ"/>, <LockInfo locker="136598104 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970970_ReadCommittedLocker" type="READ"/>, <LockInfo locker="144315285 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970968_ReadCommittedLocker" type="READ"/>, <LockInfo locker="997957532 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970975_ReadCommittedLocker" type="READ"/>, <LockInfo locker="824957254 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970961_ReadCommittedLocker" type="READ"/>, <LockInfo locker="902142946 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970967_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1081945602 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970977_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1515693665 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970981_ReadCommittedLocker" type="READ"/>, <LockInfo locker="812406941 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970964_ReadCommittedLocker" type="READ"/>, <LockInfo locker="422429761 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970966_ReadCommittedLocker" type="READ"/>, <LockInfo locker="196056145 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970976_ReadCommittedLocker" type="READ"/>, <LockInfo locker="875714517 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970971_Read
    CommittedLocker" type="READ"/>, <LockInfo locker="1428454328 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970969_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1312200883 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970985_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1650669538 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970986_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1609173220 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970983_ReadCommittedLocker" type="READ"/>, <LockInfo locker="2112741869 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970982_ReadCommittedLocker" type="READ"/>, <LockInfo locker="210489138 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970980_ReadCommittedLocker" type="READ"/>, <LockInfo locker="785375757 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970973_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1375853437 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970978_ReadCommittedLocker" type="READ"/>, <LockInfo locker="2012288410 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970988_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1958833914 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970987_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1197284088 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970984_Re
    adCommittedLocker" type="READ"/>, <LockInfo locker="831894626 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970979_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1534437212 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970911_ReadCommittedLocker" type="READ"/>, <LockInfo locker="155105261 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970922_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1956457816 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970919_ReadCommittedLocker" type="READ"/>, <LockInfo locker="2064394295 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970928_ReadCommittedLocker" type="READ"/>, <LockInfo locker="1529115133 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970936_ReadCommittedLocker" type="READ"/>, <LockInfo locker="901236682 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970943_ReadCommittedLocker" type="READ"/>, <LockInfo locker="882752083 -1_TH_CGTOutCylSMS5 for gOutMsgID 96970937_ReadCommittedLocker" type="READ"/>]
    This has today resulted in, during shutdown:
    com.sleepycat.je.EnvironmentFailureException: (JE 4.1.17) Txn undo for LSN=0x4c5d59/0x2fd8da UNEXPECTED_EXCEPTION: Unexpected internal Exception, may have side effects.
    Problem: 376426 locks left
    java.lang.OutOfMemoryError
    Java heap space
    java.util.Arrays.copyOf(Arrays.java:2882)
    java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
    java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
    java.lang.StringBuilder.append(StringBuilder.java:119)
    java.lang.StringBuilder.append(StringBuilder.java:115)
    com.sleepycat.je.txn.LockManager.dumpToStringNoLatch(LockManager.java:1205)
    com.sleepycat.je.txn.LockManager.dumpToString(LockManager.java:1187)
    com.sleepycat.je.txn.LockManager.dump(LockManager.java:1177)
    com.sleepycat.je.dbi.EnvironmentImpl.checkLeaks(EnvironmentImpl.java:1786)
    com.sleepycat.je.dbi.EnvironmentImpl.doClose(EnvironmentImpl.java:1642)
    com.sleepycat.je.dbi.DbEnvPool.closeEnvironment(DbEnvPool.java:348)
    com.sleepycat.je.dbi.EnvironmentImpl.close(EnvironmentImpl.java:1480)
    com.sleepycat.je.Environment.closeInternal(Environment.java:460)
    com.sleepycat.je.Environment.close(Environment.java:321)
    and also an entry in the je.log:
    120122 19:55:18:205 SEVERE [prog/citrine/db]LNUndo success=false node=46893596705 lsn=0x4c5d59/0x2fd8da found=false replaced=false inserted=false index=-1
    We are using 4.1.17 (also previously used 4.1.10 with the same problem) on java 1.6.0u27, 64-bit, on CentOS. The size of the database is over 250 GB.
    We am currently running a database.verify() to ensure that the data isnt corrupt.
    Our questions are:
    * The locks seem to be read locks. While i am aware that the Java Edition does not have MVCC, is there any other mechanism that will give similar 'locklessness'?
    * Should increasing the setting of LOCK_N_LOCK_TABLES to say, 500, reduce the chances of this issue?
    * Are there any other lock-specific settings we should be aware of? We have set the reads to READ_COMMITTED.
    and more immediately:
    * Is database.verify sufficient to verify that there is no corruption of data? (It has been running for over half an hour now) There is only one database in the environment.
    Awaiting your response,
    Sushant A.

    I have some additional comments.
    The SEVERE log message that you describe should be accompanied by a stack trace. If you have one, please send it. If there was no stack trace, then it is possible this is due to an OutOfMemoryError. This is likely due to the large number of locks that have accumulated.
    Increasing the number of JE lock tables will not solve this problem. The number of lock tables is increased for better concurrency at a lower level. It won't avoid lock timeouts.
    In the stack trace you sent, one thread holds a write lock, and many threads are waiting on a read lock. Lock timeouts can occur because the writer holds the lock (does not commit/abort the txn) for the timeout interval, but this seems unlikely since it looks like you have set the timeout to 30s.
    The other reason for the exception is a deadlock. Deadlocks are described in the doc link I sent you earlier. If a deadlock occurs, you'll need to retry the operation after closing the cursors and aborting the txn.
    Because many (300k) locks have accumulated, I strongly suspect your app is not closing cursors and/or txns when an exception occurs. The first thing is to check for that.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need suggestions for concurrent reads while deleting all entities

    Hello,
    we need some suggestions for the following use case, as we cannot seem to find the correct transaction locking combination to meet our needs.
    We are using BDB JE 4.1.10, and the entityStore is transactional. In a nutshell, BDB JE is used as a Cache for specific data that is pulled and updated regularly from a source Oracle DB. The application that holds BDB is a realtimel app, and response time is critical.
    In order to avoid having to merge (Insert/update/delete) entities for some of the tables that are very static and small (a few hundred records that might change every day or so), we are trying to simply delete all records (with an EntityCursor loop, since there is no 'deleteAll' that we could find) and reinsert all data every 5 minutes, and then committing when the whole process is complete. This should always be very quick, but we are not immune to timeouts from the source Oracle DB, so the transaction can be long.
    Ideally, while the delete/insert is happening, we want any concurrent read operations to return the old data (before the delete). We have made a test that locks the updater thread between the 'delete all' and 'update all' methods, so that the delete cursor is closed, but the Tx is not yet commited. We have tried the following for our reader thread:
    1- If we get() a deleted entity with a LockMode.READ_UNCOMMITTED, we get a null entity back.
    2- If we get() a deleted entity with LockMode.READ_COMMITTED, we get a LockTimeoutException.
    We have also considered simply using truncate on the EntityStore, but this requires closing and reopening the DB, so this would not work for our need to always return a value, instantly.
    Any ideas, suggestions on how we could do this in a simple manner?
    Thanks,
    Max

    Hello Max,
    I understand the issue you're describing.
    I think the best performing solution by far is to load the new data into new databases while servicing reads from the old databases. When the load is complete, reads can be diverted to the new databases, and the old databases can then be removed.
    Unfortunately, this is easier to do with the base API than with the DPL, because the DPL is managing the underlying (base API level) databases for you.
    However, even using the DPL, this approach could be very straightforward if you happen to be keeping this data set (the one that needs to be reloaded) in a separate EntityStore, or you can change your application to do so. If so, you can create a new (empty) EntityStore with a different name and use this store for loading the new data. When the load is complete, divert reads to the new EntityStore object and remove all databases for the old EntityStore.
    If this is impractical, please explain, and I'll try to suggest a different solution. If you cannot use a separate EntityStore for this particular data set, then the solution may be more complex.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Commit/Rollback in EclipseLink

    Hi,
    Most of my changes are wrapped in a pair of
    EntityManagerHelper.beginTransaction();
    save(entity);//or delete(), update(), ...
    EntityManagerHelper.commit();
    How do I handle exceptions and rollbacks?
    In the above example, do I catch all exceptions (ie, Throwable) and do a rollback (EntityManagerHelper.rollback())?
    Without any rollbacks, EclipseLink complains about inconsistant transactions (already in a transaction), when failures occur.
    Regards,
    Ramin

    Hello,
    EclipseLink unit tests generally wrap test code within a try/catch block an call:
    if (getEntityManager().getTransaction().isActive()){
    getEntityManager().getTransaction().rollback();
    at the end to rollback the transaction if it hasn't already. The if statement will prevent rolling back the transaction if it is not active.
    Most JPA exceptions should mark the transaction for rollback already though, as per the spec:
    "All instances of PersistenceException except for instances of NoResultException, NonUniqueResultException, LockTimeoutException, and
    QueryTimeoutException will cause the current transaction, if one is active, to be marked for rollback."
    Best Regards,
    Chris

  • F4fpackager generates bad tenant path?

    Hi,
    Now that f4fpackager is also encrypting the files, I tried playing them. When the player posts to the licenseserver (to flashaccessserver/tenants/sampletenant/flashaccess/license/v1) it gets an HTTP 500 Internal Server Error response, and there is exception information in the flashaccess-partition log file (see below).
    It looks as though something in the data sent is looking for  /home/apache/apache-tomcat-6.0.29/licenseserver/flashaccessserver/tenants/tenants/flashac cess-tenant.xml
    when in fact the file is located in  /home/apache/apache-tomcat-6.0.29/licenseserver/flashaccessserver/tenants/flashaccess-ten ant.xml
    This is how the license server is defined in the f4fpackager config file:
    <license-server-url>http://ootv3:8080/flashaccessserver/tenants/sampletenant</license-server-url>
    Any help would be much appreciated.
    Thanks,
    - Naomi
    From the flashaccess-partition log file:
    [#:1] 2011-01-25 11:50:11,436 INFO  [[Partition(flashaccessserver)].com.adobe.flashaccess.server.license.context.SimpleContex tFactory] Creating class loader for partition 'flashaccessserver' with libraries '[file:/home/apache/apache-tomcat-6.0.29/licenseserver/flashaccessserver/libs/, file:/home/apache/apache-tomcat-6.0.29/licenseserver/flashaccessserver/libs/flashaccess-l icense-server-ext-sample.jar]'
    [#:1] 2011-01-25 11:50:11,439 DEBUG [[Partition(flashaccessserver)].com.adobe.flashaccess.server.license.engine.LicenseEngine ] Started processing request...
    [#:1] 2011-01-25 11:50:11,451 ERROR [[Partition(flashaccessserver)].com.adobe.flashaccess.server.license.engine.LicenseEngine ] Error occurred processing license acquisition request
    net.sf.ehcache.constructs.blocking.LockTimeoutException: Could not update object for cache entry with key "flashaccessserver////tenants".
            at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.get(UpdatingSelfPopulating Cache.java:90)
            at net.sf.ehcache.constructs.blocking.BlockingCache.get(BlockingCache.java:558)
            at com.adobe.flashaccess.server.license.configuration.cachedecorator.CacheDecoratorConfigura tionFactory.getTenantConfiguration(CacheDecoratorConfigurationFactory.java:211)
            at com.adobe.flashaccess.server.license.context.ContextImpl.getTenantConfiguration(ContextIm pl.java:98)
            at com.adobe.flashaccess.server.license.extension.CustomAuthorizerChainExtension.setConfig(C ustomAuthorizerChainExtension.java:61)
            at com.adobe.flashaccess.server.license.extension.CustomAuthorizerChainExtension.setConfig(C ustomAuthorizerChainExtension.java:52)
            at com.adobe.flashaccess.server.generic.extension.ExtensionChain.<init>(ExtensionChain.java: 50)
            at com.adobe.flashaccess.server.generic.engine.AbstractEngine.processLicenseRequest(Abstract Engine.java:67)
            at com.adobe.flashaccess.server.license.servlet.LicenseEngineDelegatorServlet.doPost(License EngineDelegatorServlet.java:53)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
            at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java: 436)
            at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:342)
            at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
            at com.adobe.flashaccess.server.license.servlet.LicenseRequestDispatchFilter.doFilter(Licens eRequestDispatchFilter.java:72)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.adobe.flashaccess.server.license.servlet.RequestCountFilter.doFilter(RequestCountFilt er.java:74)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja va:588)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
            at java.lang.Thread.run(Unknown Source)
    Caused by: net.sf.ehcache.CacheException: Could not fetch object for cache entry with key "flashaccessserver////tenants".
            at net.sf.ehcache.constructs.blocking.SelfPopulatingCache.get(SelfPopulatingCache.java:87)
            at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.get(UpdatingSelfPopulating Cache.java:76)
            ... 32 more
    Caused by: com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment$DeploymentException: Could not find tenant configuration file 'flashaccess-tenant.xml' for partition 'flashaccessserver', tenant 'tenants'
            at com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment.getTenantConfigurationResource(MultiTenantDeployment.java:85)
            at com.adobe.flashaccess.server.license.configuration.commonsadapter.CommonsConfigurationBas edFactory.getTenantConfiguration(CommonsConfigurationBasedFactory.java:89)
            at com.adobe.flashaccess.server.license.configuration.cachedecorator.CacheDecoratorConfigura tionFactory$TenantConfigurationEntryFactory.getWrappedConfiguration(CacheDecoratorConfigur ationFactory.java:352)
            at com.adobe.flashaccess.server.license.configuration.cachedecorator.CacheDecoratorConfigura tionFactory$BaseUpdatingCacheEntryFactory.createEntry(CacheDecoratorConfigurationFactory.j ava:315)
            at net.sf.ehcache.constructs.blocking.SelfPopulatingCache.get(SelfPopulatingCache.java:71)
            ... 33 more
    Caused by: java.io.FileNotFoundException: /home/apache/apache-tomcat-6.0.29/licenseserver/flashaccessserver/tenants/tenants/flashac cess-tenant.xml
            at com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment$UpdatableFileSystemResource.<init>(MultiTenantDeployment.java:263)
            at com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment.getTenantConfigurationResource(MultiTenantDeployment.java:83)
            ... 37 more
    [#:2] 2011-01-25 11:50:11,577 DEBUG [[Partition(flashaccessserver)].com.adobe.flashaccess.server.license.engine.LicenseEngine ] Started processing request...
    [#:2] 2011-01-25 11:50:11,578 ERROR [[Partition(flashaccessserver)].com.adobe.flashaccess.server.license.engine.LicenseEngine ] Error occurred processing license acquisition request
    net.sf.ehcache.constructs.blocking.LockTimeoutException: Could not update object for cache entry with key "flashaccessserver////tenants".
            at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.get(UpdatingSelfPopulating Cache.java:90)
            at net.sf.ehcache.constructs.blocking.BlockingCache.get(BlockingCache.java:558)
            at com.adobe.flashaccess.server.license.configuration.cachedecorator.CacheDecoratorConfigura tionFactory.getTenantConfiguration(CacheDecoratorConfigurationFactory.java:211)
            at com.adobe.flashaccess.server.license.context.ContextImpl.getTenantConfiguration(ContextIm pl.java:98)
            at com.adobe.flashaccess.server.license.extension.CustomAuthorizerChainExtension.setConfig(C ustomAuthorizerChainExtension.java:61)
            at com.adobe.flashaccess.server.license.extension.CustomAuthorizerChainExtension.setConfig(C ustomAuthorizerChainExtension.java:52)
            at com.adobe.flashaccess.server.generic.extension.ExtensionChain.<init>(ExtensionChain.java: 50)
            at com.adobe.flashaccess.server.generic.engine.AbstractEngine.processLicenseRequest(Abstract Engine.java:67)
            at com.adobe.flashaccess.server.license.servlet.LicenseEngineDelegatorServlet.doPost(License EngineDelegatorServlet.java:53)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
            at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java: 436)
            at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:342)
            at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
            at com.adobe.flashaccess.server.license.servlet.LicenseRequestDispatchFilter.doFilter(Licens eRequestDispatchFilter.java:72)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.adobe.flashaccess.server.license.servlet.RequestCountFilter.doFilter(RequestCountFilt er.java:74)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja va:588)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
            at java.lang.Thread.run(Unknown Source)
    Caused by: net.sf.ehcache.CacheException: Could not fetch object for cache entry with key "flashaccessserver////tenants".
            at net.sf.ehcache.constructs.blocking.SelfPopulatingCache.get(SelfPopulatingCache.java:87)
            at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.get(UpdatingSelfPopulating Cache.java:76)
            ... 32 more
    Caused by: com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment$DeploymentException: Could not find tenant configuration file 'flashaccess-tenant.xml' for partition 'flashaccessserver', tenant 'tenants'
            at com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment.getTenantConfigurationResource(MultiTenantDeployment.java:85)
            at com.adobe.flashaccess.server.license.configuration.commonsadapter.CommonsConfigurationBas edFactory.getTenantConfiguration(CommonsConfigurationBasedFactory.java:89)
            at com.adobe.flashaccess.server.license.configuration.cachedecorator.CacheDecoratorConfigura tionFactory$TenantConfigurationEntryFactory.getWrappedConfiguration(CacheDecoratorConfigur ationFactory.java:352)
            at com.adobe.flashaccess.server.license.configuration.cachedecorator.CacheDecoratorConfigura tionFactory$BaseUpdatingCacheEntryFactory.createEntry(CacheDecoratorConfigurationFactory.j ava:315)
            at net.sf.ehcache.constructs.blocking.SelfPopulatingCache.get(SelfPopulatingCache.java:71)
            ... 33 more
    Caused by: java.io.FileNotFoundException: /home/apache/apache-tomcat-6.0.29/licenseserver/flashaccessserver/tenants/tenants/flashac cess-tenant.xml
            at com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment$UpdatableFileSystemResource.<init>(MultiTenantDeployment.java:263)
            at com.adobe.flashaccess.server.license.configuration.deployment.filebased.MultiTenantDeploy ment.getTenantConfigurationResource(MultiTenantDeployment.java:83)
            ... 37 more

    That was the problem! My apologies - I was sure I had lifted the license server URL from my configuration for the Flash Access packager but I see I typed it freehand without checking the documentation first.
    Thanks and sorry for the trouble!
    - Naomi

  • Com.bea.wcp.sip.engine.server.UnableToLockException

    Hi,
    I am getting the following error thrown from some engine tier nodes and was hoping that someone could explain what the problems is:
    com.bea.wcp.sip.engine.server.UnableToLockException: Could not lock call state even after waiting for more than 5000 ms
    at com.bea.wcp.sip.engine.server.CallStateManager.enter(CallStateManager.java:220)
    at com.bea.wcp.sip.engine.SipSessionsUtilAdapter.getApplicationSessionById(SipSessionsUtilAdapter.java:135)
    <snip>
    Caused by: com.bea.wcp.sip.engine.server.LockTimeoutException: Could not lock call state [email protected] even after waiting for more than 5000 ms
    at com.bea.wcp.sip.engine.server.CallStateManager.doLockAndGet(CallStateManager.java:280)
    at com.bea.wcp.sip.engine.server.CallStateManager.enter(CallStateManager.java:250)
    at com.bea.wcp.sip.engine.server.CallStateManager.enter(CallStateManager.java:217)
    ... 52 more
    Do I need to be doing explicit lock/unlocking of a session or suchlike? I imagined that the container would take care of all that for me?
    Thanks in advance
    Huw

    Hello,
    1. Before a servlet's doXX() method is entered, the call state (basically the application session and all SIP and HTTP sessions belonging to it) is locked so that only one thread can access it at one time.
    2. So there is another doXXX() method or SIP timer that look the session for more than 5 seconds. Maybe there is some not sip related code inside the method such as DB calls that makes the execution of the method too slow. Thread dumps might show this.
    3. OCCAS 5.0 introduces its own API for avoiding session locking and if an application knows what it does it can access the session asynchronous as well. So when you can't move the blocking work to a place where no sip session access is needed such as delegating to a JMS listener, you might like to define an WlssAsynchronousAction that does not block the session.
    SipApplicationSession appSession = ...;
    WlssSipApplicationSession wlssAppSession = (WlssSipApplicationSession) appSession;
    wlssAppSession.doAsynchronousAction(new WlssAsynchronousAction() {
    public Object run() throws Exception {
    // add your business logic here
    appSession.setAttribute("counter", latestCounterValue);
    sipSession.setAttribute("currentState", latestAppState);
    return null;
    See: http://download.oracle.com/docs/cd/E17645_01/doc.50/e18767/html/com/bea/wcp/sip/WlssSipApplicationSession.html
    IMPORTANT: But still the first step should be to avoid long running code in a SIP doXX() or timer method.
    Best regards,
    Kai
    To reach a wider audience for your question please consider posting on
    the My Oracle Support forum
    https://communities.oracle.com/portal/server.pt/community/service_delivery_platform.
    _____________________________

  • Lock/isolation with secondary databases

    Hi all,
    Some more questions from me - sorry for the never-ending stream, but I'm hoping the solutions at least will help others who potentially strike the same or similar issues.
    My environment is a reasonable size (~21M rows, ~10G) and is made up of a primary DB enforcing uniqueness on keys and secondary to provide an alternate sort order for traversal.
    Ostensibly, all writes occur in a single thread on the primary DB (naturally), whilst ostensibly all reads occur on the secondary in multiple threads.
    I noticed that I very quickly got lock timeout errors looking something like:
    04:45:30.349 [Grizzly(14)] ERROR c.a.w.web.resources.SearchResource - (JE 5.0.55) Lock expired. Locker 902555936 -1_Grizzly(14)_ThreadLocker: waited for lock on database=calendar_routecost LockAddr:2118856719 LSN=0xaf8/0x95e879 type=READ grant=WAIT_NEW timeoutMillis=500 startTime=1342586729848 endTime=1342586730348
    Owners: [<LockInfo locker="2925905 3536_Loader_Txn" type="WRITE"/>]
    Waiters: []
    com.sleepycat.je.LockTimeoutException: (JE 5.0.55) Lock expired. Locker 902555936 -1_Grizzly(14)_ThreadLocker: waited for lock on database=calendar_routecost LockAddr:2118856719 LSN=0xaf8/0x95e879 type=READ grant=WAIT_NEW timeoutMillis=500 startTime=1342586729848 endTime=1342586730348
    Owners: [<LockInfo locker="2925905 3536_Loader_Txn" type="WRITE"/>]
    Waiters: []
    I've switched all my reads to READ_UNCOMMITTED in an effort to keep the time that records are locked to an absolute minimum, however, in the case above it's obviously WRITE locks in the Loader thread that's causing the lock timeout (the locked database mentioned is the secondary in the example).
    From my reading of the documentation, it appears that all records modified within a transaction retain exclusive locks during the entire lifetime of the transaction - is this correct? If so, doesn't this somewhat defeat the purpose of transactional isolation if a transaction takes an exclusive lock on records whilst modifying them?
    In my case, transactions were large and fairly long-lived (ie: up to 4 seconds) which was well in excess of read timeouts. I found if I drastically reduced my transaction size, I was able to keep transaction times <500ms, which means the lock timeout doesn't occur, however, it seems like a very fragile solution.
    Additionally, I am accessing the secondary DB using a StoredSortedMap, rather than directly through cursors, which from my understanding is transaction-aware providing the DB is configured as being transactional (which mine is).
    So, my questions are:
    - Is this the right approach to avoiding lock timeouts?
    - Is there a way to give readers lock preference to writers? (I'd prefer writes block than reads)
    - Is it better to make transactions tiny and frequent (ie: thousands per second) to avoid this?
    - Is there an advantage to switching off the Collections interface to the DB?

    I've switched all my reads to READ_UNCOMMITTED in an effort to keep the time that records are locked to an absolute minimum, however, in the case above it's obviously WRITE locks in the Loader thread that's causing the lock timeout (the locked database mentioned is the secondary in the example).Using read-uncommitted is a good way to reduce contention, if you can really live with the fact that the data you read is not committed and its transaction may be aborted (undone).
    From my reading of the documentation, it appears that all records modified within a transaction retain exclusive locks during the entire lifetime of the transaction - is this correct? If so, doesn't this somewhat defeat the purpose of transactional isolation if a transaction takes an exclusive lock on records whilst modifying them?On the contrary, locking is what isolates the transactions. Holding the write lock until the end of the txn is textbook two-phase locking, although some databases use other techniques. Have you read the "Writing Transactional Applications" guide that's in our docs? It explains locking and how to write your application to deal with lock exceptions.
    In my case, transactions were large and fairly long-lived (ie: up to 4 seconds) which was well in excess of read timeouts. I found if I drastically reduced my transaction size, I was able to keep transaction times <500ms, which means the lock timeout doesn't occur, however, it seems like a very fragile solution.In all databases, the smaller the transaction the better. If you can reduce your txn size, the real question is why wouldn't you.
    If you have good reasons for having a long transaction, adjusting the lock timeout may be necessary. The default of 500ms is just that, a default, and there is nothing wrong with changing it.
    Additionally, I am accessing the secondary DB using a StoredSortedMap, rather than directly through cursors, which from my understanding is transaction-aware providing the DB is configured as being transactional (which mine is).Yes, the collections API uses the per-thread txn (if you've set one) and uses auto-commit otherwise.
    - Is this the right approach to avoiding lock timeouts?In addition to what I said above, you will probably need to do retries, as described in the guide I mentioned.
    - Is there a way to give readers lock preference to writers? (I'd prefer writes block than reads)No, there isn't.
    - Is it better to make transactions tiny and frequent (ie: thousands per second) to avoid this?Absolutely.
    - Is there an advantage to switching off the Collections interface to the DB?In general, no.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • How do I download itunes to my non-apple tablet

    I would like to download itunes on my tablet, but can't seem to open a link that will download.

  • CS4 Installation Issues

    Hi, I'm having a rather difficult time re-installing my Adobe CS4. I had it installed on windows 7 before, but recently crashed it. When I went to reinstall Adobe it comes up with "Installation Error" on the first disk and tells me all the programs h

  • Can't setup new macpro

    i just got my new mac pro and connected it to an older Apple 23'' cinema display. the display has both a USB and a firewire plug that had corresponding ports in my old G5. however the firewire ports on the mac pro are the wrong shape to take the plug

  • Lost my Font Book 2.1 app - can I download or find on install DVD?

    Hi, Due to an upgrade accident, I lost my Leopard Font Book (2.1) app. I've tried to find a new copy via download or on the Leopard install DVD, to no avail. Is it available anywhere? Thanks! -Noah

  • Check formate

    SAP guru's:_ we are use the APP we can made the payment this APP, so at that time we want check printing size formate (check model) increase, or decrease, as the bank of measurement(eg:- SBI small suppose if HDFC big) as the formate level we want che