Vishal,

can you please create a new issue at http://jira.codehaus.org/browse/CASTOR, 
and attach everything required to replay 
your problems. Having said that, I'd appreciate if you followed the bug 
submission guidelines available at

http://castor.org/how-to-submit-a-bug.html

when attaching a patch to the issue to be created.

Thanks
Werner

On Tue, 6 Sep 2005 15:42:31 +0530, [EMAIL PROTECTED] wrote:

>
>Werner,
>
>I downloaded Castor 0.9.7 and tried the test with that. I still get the same 
>problem.
>
>Regards, Vishal.
>
>[test]# java TestRelatedLock
>Current Time:: 1125996045391
>Sep 6, 2005 3:45:46 AM org.exolab.castor.jdo.engine.SQLEngine load
>SEVERE: A fatal error occurred while loading CounterType using SQL: SELECT 
>COUNTER_TYPE.counter_type_desc 
FROM COUNTER_TYPE WHERE COUNTER_TYPE.counter_type_id=? FOR UPDATE
>java.sql.SQLException: Deadlock found when trying to get lock; Try restarting 
>transaction message from server: "Lock 
wait timeout exceeded; Try restarting transaction"
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
>        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
>        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
>        at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
>        at 
> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
>        at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1146)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:708)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:605)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:774)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:584)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:567)
>        at TestRelatedLock.main(TestRelatedLock.java:48)
>PERSISTENCE EXCEPTION!!!
>Current Time:: 1125996045391
>org.exolab.castor.jdo.PersistenceException: Nested error: 
>java.sql.SQLException: Deadlock found when trying to get 
lock; Try restarting transaction message from server: "Lock wait timeout 
exceeded; Try restarting transaction": Deadlock 
found when trying to get lock; Try restarting transaction message from server: 
"Lock wait timeout exceeded; Try restarting 
transaction"
>        at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1227)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:708)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:605)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:774)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:584)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:567)
>        at TestRelatedLock.main(TestRelatedLock.java:48)
>Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try 
>restarting transaction message from 
server: "Lock wait timeout exceeded; Try restarting transaction"
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
>        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
>        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
>        at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
>        at 
> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
>        at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1146)
>        ... 11 more
>Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try 
>restarting transaction message from 
server: "Lock wait timeout exceeded; Try restarting transaction"
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
>        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
>        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
>        at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
>        at 
> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
>        at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1146)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:708)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:605)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:774)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:584)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:567)
>        at TestRelatedLock.main(TestRelatedLock.java:48)
>Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try 
>restarting transaction message from 
server: "Lock wait timeout exceeded; Try restarting transaction"
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
>        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
>        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
>        at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
>        at 
> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
>        at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1146)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:708)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:605)
>        at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:774)
>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:366)
>        at 
> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:699)
>        at org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:584)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:567)
>        at TestRelatedLock.main(TestRelatedLock.java:48)
>java.lang.NullPointerException
>        at 
> org.exolab.castor.persist.ClassMolder.revertObject(ClassMolder.java:2513)
>        at 
> org.exolab.castor.persist.LockEngine.revertObject(LockEngine.java:860)
>        at 
> org.exolab.castor.persist.TransactionContext.rollback(TransactionContext.java:1793)
>        at 
> org.exolab.castor.jdo.engine.DatabaseImpl.rollback(DatabaseImpl.java:550)
>        at TestRelatedLock.main(TestRelatedLock.java:81)
>java.lang.IllegalStateException: Transaction [EMAIL PROTECTED] does not hold 
the read lock: CounterType/1/1 -/-!
>        at 
> org.exolab.castor.persist.LockEngine$TypeInfo.assure(LockEngine.java:1353)
>        at 
> org.exolab.castor.persist.LockEngine$TypeInfo.access$500(LockEngine.java:1057)
>        at 
> org.exolab.castor.persist.LockEngine.revertObject(LockEngine.java:859)
>        at 
> org.exolab.castor.persist.TransactionContext.rollback(TransactionContext.java:1793)
>        at 
> org.exolab.castor.jdo.engine.DatabaseImpl.rollback(DatabaseImpl.java:550)
>        at TestRelatedLock.main(TestRelatedLock.java:81)
>GENERAL EXCEPTION!!!
>Current Time:: 1125996045391
>java.lang.NullPointerException
>        at 
> org.exolab.castor.jdo.engine.DatabaseImpl.getLockEngine(DatabaseImpl.java:223)
>        at 
> org.exolab.castor.jdo.engine.OQLQueryImpl.create(OQLQueryImpl.java:241)
>        at 
> org.exolab.castor.jdo.engine.DatabaseImpl.getOQLQuery(DatabaseImpl.java:438)
>        at TestRelatedLock.main(TestRelatedLock.java:38)
>[test]#
>
>-----Original Message-----
>From: Werner Guttmann [mailto:[EMAIL PROTECTED]
>Sent: Monday, September 05, 2005 8:41 PM
>To: [email protected]
>Subject: AW: [castor-dev] Having trouble with implementing a retrieve retry
>
>Vishal,
>
>as far as i remember, with Castor 0.9.7 (or earlier, but I am not sure) we 
>have introduced a patch for problems where in 
very specific situations locks didn't get released. And as far as I can tell by 
the stack trace quoted below, this might be the 
case in your example given. Can you please give either 0.9.7 or 0.9.9M1 a try, 
and see whether you still get the same 
problem ?
>
>Werner
>
>-----Ursprüngliche Nachricht-----
>Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Gesendet: Montag, 05. September 2005 14:11
>An: [email protected]
>Betreff: [castor-dev] Having trouble with implementing a retrieve retry
>
>
>
>Hi,
>
>I have a requirement for my application that in some cases when we get a
>retrieve timeout from the database we should retry the retrieve. We do
>this by catching the PersistenceException from the call to query.execute
>and retrying the retrieve after having rolled back and re-begun the
>transaction (The test program and associated artifacts are attached).
>
>This normally works just fine, but I have run into a situation where
>when trying to retrieve an object that is related to another object, and
>if the related object is locked by some other process, then I run into
>fatal exceptions from Castor while trying to rollback the transaction
>and my subsequent attempts to retry the retrieve fail.
>
>Is this a know bug? I am currently using Castor 0.9.5.3 with MySQL
>4.0.25.
>
>Regards, Vishal.
>
>e.g. I have a sample class CounterVar which has a reference to the class
>CounterType. When trying to retrieve CounterVar (when I have locked the
>corresponding CounterType object in another process) I get the following
>exception during the rollback and subsequent retry:
>
>[test]# java Test
>Current Time:: 1125909746547
>Sep 5, 2005 3:47:27 AM org.exolab.castor.jdo.engine.SQLEngine load
>SEVERE: A fatal error occurred while loading CounterType using SQL:
>SELECT COUNTER_TYPE.counter_type_desc FROM COUNTER_TYPE WHERE
>COUNTER_TYPE.counter_type_id=? FOR UPDATE
>PERSISTENCE EXCEPTION!!!
>Current Time:: 1125909746547
>java.sql.SQLException: Deadlock found when trying to get lock; Try
>restarting transaction message from server: "Lock wait timeout exceeded;
>Try restarting transaction"
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
>        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
>        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
>        at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
>        at
>com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:158
>6)
>        at
>org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1049)
>        at
>org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:708)
>        at
>org.exolab.castor.persist.LockEngine.load(LockEngine.java:357)
>        at
>org.exolab.castor.persist.TransactionContext.load(TransactionContext.jav
>a:651)
>        at
>org.exolab.castor.persist.TransactionContext.load(TransactionContext.jav
>a:556)
>        at
>org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:795)
>        at
>org.exolab.castor.persist.LockEngine.load(LockEngine.java:357)
>        at
>org.exolab.castor.persist.TransactionContext.load(TransactionContext.jav
>a:651)
>        at
>org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
>        at
>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQuer
>yImpl.java:631)
>        at
>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQuer
>yImpl.java:614)
>        at Test.main(Test.java:48)
>java.lang.NullPointerException
>        at
>org.exolab.castor.persist.ClassMolder.revertObject(ClassMolder.java:2518
>)
>        at
>org.exolab.castor.persist.LockEngine.revertObject(LockEngine.java:861)
>        at
>org.exolab.castor.persist.TransactionContext.rollback(TransactionContext
>.java:1722)
>        at
>org.exolab.castor.jdo.engine.DatabaseImpl.rollback(DatabaseImpl.java:546
>)
>        at Test.main(Test.java:81)
>java.lang.IllegalStateException: Transaction
>[EMAIL PROTECTED] does not hold
>the read lock: CounterType/1/1 -/-!
>        at
>org.exolab.castor.persist.LockEngine$TypeInfo.assure(LockEngine.java:129
>8)
>        at
>org.exolab.castor.persist.LockEngine$TypeInfo.access$500(LockEngine.java
>:1030)
>        at
>org.exolab.castor.persist.LockEngine.revertObject(LockEngine.java:860)
>        at
>org.exolab.castor.persist.TransactionContext.rollback(TransactionContext
>.java:1722)
>        at
>org.exolab.castor.jdo.engine.DatabaseImpl.rollback(DatabaseImpl.java:546
>)
>        at Test.main(Test.java:81)
>GENERAL EXCEPTION!!!
>Current Time:: 1125909746547
>java.lang.NullPointerException
>        at
>org.exolab.castor.jdo.engine.DatabaseImpl.getLockEngine(DatabaseImpl.jav
>a:202)
>        at
>org.exolab.castor.jdo.engine.OQLQueryImpl.create(OQLQueryImpl.java:257)
>        at
>org.exolab.castor.jdo.engine.DatabaseImpl.getOQLQuery(DatabaseImpl.java:
>445)
>        at Test.main(Test.java:38)
>[test]#
>
>***************************************
>How to run the attached program:
>***************************************
>After having done the setup (create DB etc) login into the DB and lock
>the COUNTER_TYPE row (id=1 in this case):
>mysql> begin;
>mysql> select * from COUNTER_TYPE where COUNTER_TYPE_ID=1 for UPDATE;
>
>Then execute the attached Test program. The retrieve will eventually
>timeout (depending on the timeout value set in the DB). That is when the
>errors are observed.
>
>
>
>
>Confidentiality Notice
>
>
>The information contained in this electronic message and any attachments to 
>this message are intended
>for the exclusive use of the addressee(s) and may contain confidential or 
>privileged information. If
>you are not the intended recipient, please notify the sender at Wipro or 
>[EMAIL PROTECTED] immediately
>and destroy all copies of this message and any attachments.
>
>-------------------------------------------------
>If you wish to unsubscribe from this list, please
>send an empty message to the following address:
>
>[EMAIL PROTECTED]
>-------------------------------------------------
>
>
>
>
>Confidentiality Notice
>
>The information contained in this electronic message and any attachments to 
>this message are intended
>for the exclusive use of the addressee(s) and may contain confidential or 
>privileged information. If
>you are not the intended recipient, please notify the sender at Wipro or 
>[EMAIL PROTECTED] immediately
>and destroy all copies of this message and any attachments.
>
>-------------------------------------------------
>If you wish to unsubscribe from this list, please 
>send an empty message to the following address:
>
>[EMAIL PROTECTED]
>-------------------------------------------------
>





-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to