You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Dejan Bosanac (JIRA)" <ji...@apache.org> on 2009/12/23 16:33:40 UTC

[jira] Created: (AMQ-2551) Locking issue with MySQL InnoDB

Locking issue with MySQL InnoDB
-------------------------------

                 Key: AMQ-2551
                 URL: https://issues.apache.org/activemq/browse/AMQ-2551
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.3.0
            Reporter: Dejan Bosanac


Using jdbc with Mysql InnoDB, can lead to following errors

{code}Deadlock found when trying to get lock;try restarting transaction{code}

and messages stuck in database.

The problem is described here http://dev.mysql.com/doc/refman/5.0/en/innodb-lock-modes.html and is caused by unsynced cleanup task. 

Current workaround is to turn off cleanup task like this

{code}<jdbcPersistenceAdapter dataSource="#mysql-ds"  ... cleanupPeriod="0"/>{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-2551) Locking issue with MySQL InnoDB

Posted by "Bruce Snyder (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruce Snyder updated AMQ-2551:
------------------------------

    Fix Version/s: 5.5.0
                       (was: 5.4.1)

> Locking issue with MySQL InnoDB
> -------------------------------
>
>                 Key: AMQ-2551
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2551
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.3.0
>            Reporter: Dejan Bosanac
>             Fix For: 5.5.0
>
>
> Using jdbc with Mysql InnoDB, can lead to following errors
> {code}Deadlock found when trying to get lock;try restarting transaction{code}
> and messages stuck in database.
> The problem is described here http://dev.mysql.com/doc/refman/5.0/en/innodb-lock-modes.html and is caused by unsynced cleanup task. 
> Current workaround is to turn off cleanup task like this
> {code}<jdbcPersistenceAdapter dataSource="#mysql-ds"  ... cleanupPeriod="0"/>{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2551) Locking issue with MySQL InnoDB

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58907#action_58907 ] 

Gary Tully commented on AMQ-2551:
---------------------------------

{code}2010-04-14 15:33:24,044 | WARN  | Failure Details: Deadlock found when trying to get lock; try restarting transaction | org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | ActiveMQ Cleanup Timer
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.Util.getInstance(Util.java:381)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1045)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
	at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doDeleteOldMessages(DefaultJDBCAdapter.java:617)
	at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.cleanup(JDBCPersistenceAdapter.java:317)
	at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter$4.run(JDBCPersistenceAdapter.java:287)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
2010-04-14 15:38:25,498 | WARN  | Old message cleanup failed due to:  etc...{code}

> Locking issue with MySQL InnoDB
> -------------------------------
>
>                 Key: AMQ-2551
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2551
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.3.0
>            Reporter: Dejan Bosanac
>
> Using jdbc with Mysql InnoDB, can lead to following errors
> {code}Deadlock found when trying to get lock;try restarting transaction{code}
> and messages stuck in database.
> The problem is described here http://dev.mysql.com/doc/refman/5.0/en/innodb-lock-modes.html and is caused by unsynced cleanup task. 
> Current workaround is to turn off cleanup task like this
> {code}<jdbcPersistenceAdapter dataSource="#mysql-ds"  ... cleanupPeriod="0"/>{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (AMQ-2551) Locking issue with MySQL InnoDB

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully resolved AMQ-2551.
-----------------------------

    Resolution: Fixed
      Assignee: Gary Tully

Added exclusive lock to the cleanup task such that it won't content with normal message addition. Cleanup takes care of deleting messages acked by all durable subs, so very often it has nothing to do but when it does, it needs to have exclusive access. r1030928

> Locking issue with MySQL InnoDB
> -------------------------------
>
>                 Key: AMQ-2551
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2551
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.3.0
>            Reporter: Dejan Bosanac
>            Assignee: Gary Tully
>             Fix For: 5.5.0
>
>
> Using jdbc with Mysql InnoDB, can lead to following errors
> {code}Deadlock found when trying to get lock;try restarting transaction{code}
> and messages stuck in database.
> The problem is described here http://dev.mysql.com/doc/refman/5.0/en/innodb-lock-modes.html and is caused by unsynced cleanup task. 
> Current workaround is to turn off cleanup task like this
> {code}<jdbcPersistenceAdapter dataSource="#mysql-ds"  ... cleanupPeriod="0"/>{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.