You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Jin Bal <ji...@hotmail.com> on 2004/11/30 18:43:30 UTC

Mysql deadlock / timeout

Hello 

I have an app in production that occasionally suffers from what seems to be a deadlock or timout when doing a simple update inside a transaction

here is the stacktrace - can anyone shed any light on things??

TIA

Caused by: org.apache.ojb.broker.PersistenceBrokerSQLException: java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; Try restarting transaction"

at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdateSQL(Unknown Source)

at org.apache.ojb.broker.core.MtoNBroker.deleteMtoNImplementor(Unknown Source)

at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeAndLinkMtoN(Unknown Source)

at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Unknown Source)

at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source)

at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)

at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)

at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source)

at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source)

at com.buyacar.dtofactory.OJBTransactionImpl.save(OJBTransactionImpl.java:54)

at com.buyacar.dtofactory.UserFactory.saveUser(UserFactory.java:28)



Re: Mysql deadlock / timeout - fixed I hope

Posted by Jin Bal <ji...@hotmail.com>.
We found that there is a bug with MySQL 4.0.20 that causes deadlocks in 
transactions


we have upgraded thanks for the responses

----- Original Message ----- 
From: "Robert S. Sfeir" <ro...@codepuccino.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Tuesday, November 30, 2004 5:53 PM
Subject: Re: Mysql deadlock / timeout


> Huh is OJB competing with some other processes trying to update the same
> table/db?  It looks like it's complaining that it can't get a lock on row,
> and what ever process is not giving it up.
>
> Make also sure that all your transactions end by closing the PB instance.
>
> I would add some debugging info to see which record is being updated at 
> the
> time, with a timestamp to tell you when it was happening, and I would try 
> to
> catch this specific exception and resubmit the update again once or twice
> before failing, if there indeed is another process updating the DB.
>
> Last thought... Is it around a time when you have a DB backup going on?
> Some backups make the db/table read only, and that could be a problem.
>
> HTH
> R
>
>
> On 11/30/04 12:43 PM, "Jin Bal" <ji...@hotmail.com> wrote:
>
>> Hello
>>
>> I have an app in production that occasionally suffers from what seems to 
>> be a
>> deadlock or timout when doing a simple update inside a transaction
>>
>> here is the stacktrace - can anyone shed any light on things??
>>
>> TIA
>>
>> Caused by: org.apache.ojb.broker.PersistenceBrokerSQLException:
>> java.sql.SQLException: Deadlock found when trying to get lock; Try 
>> restarting
>> transaction, message from server: "Lock wait timeout exceeded; Try 
>> restarting
>> transaction"
>>
>> at 
>> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdateSQL(Unknown
>> Source)
>>
>> at org.apache.ojb.broker.core.MtoNBroker.deleteMtoNImplementor(Unknown 
>> Source)
>>
>> at 
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeAndLinkMtoN(Unknown
>> Source)
>>
>> at 
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Unknown
>> Source)
>>
>> at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown 
>> Source)
>>
>> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
>>
>> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
>>
>> at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
>> Source)
>>
>> at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
>> Source)
>>
>> at 
>> com.buyacar.dtofactory.OJBTransactionImpl.save(OJBTransactionImpl.java:54)
>>
>> at com.buyacar.dtofactory.UserFactory.saveUser(UserFactory.java:28)
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Mysql deadlock / timeout

Posted by "Robert S. Sfeir" <ro...@codepuccino.com>.
Huh is OJB competing with some other processes trying to update the same
table/db?  It looks like it's complaining that it can't get a lock on row,
and what ever process is not giving it up.

Make also sure that all your transactions end by closing the PB instance.

I would add some debugging info to see which record is being updated at the
time, with a timestamp to tell you when it was happening, and I would try to
catch this specific exception and resubmit the update again once or twice
before failing, if there indeed is another process updating the DB.

Last thought... Is it around a time when you have a DB backup going on?
Some backups make the db/table read only, and that could be a problem.

HTH
R


On 11/30/04 12:43 PM, "Jin Bal" <ji...@hotmail.com> wrote:

> Hello 
> 
> I have an app in production that occasionally suffers from what seems to be a
> deadlock or timout when doing a simple update inside a transaction
> 
> here is the stacktrace - can anyone shed any light on things??
> 
> TIA
> 
> Caused by: org.apache.ojb.broker.PersistenceBrokerSQLException:
> java.sql.SQLException: Deadlock found when trying to get lock; Try restarting
> transaction, message from server: "Lock wait timeout exceeded; Try restarting
> transaction"
> 
> at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdateSQL(Unknown
> Source)
> 
> at org.apache.ojb.broker.core.MtoNBroker.deleteMtoNImplementor(Unknown Source)
> 
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeAndLinkMtoN(Unknown
> Source)
> 
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Unknown
> Source)
> 
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source)
> 
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
> 
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
> 
> at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> Source)
> 
> at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> Source)
> 
> at com.buyacar.dtofactory.OJBTransactionImpl.save(OJBTransactionImpl.java:54)
> 
> at com.buyacar.dtofactory.UserFactory.saveUser(UserFactory.java:28)
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org