You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "ranpeng (JIRA)" <ji...@apache.org> on 2012/05/14 10:26:50 UTC

[jira] [Commented] (AMQ-3654) JDBC Master/Slave : Slave cannot acquire lock when the master loose database connection.

    [ https://issues.apache.org/jira/browse/AMQ-3654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274504#comment-13274504 ] 

ranpeng commented on AMQ-3654:
------------------------------

i use the mysql database to store messages ,and i met the same problem. When the master loose the network connection to the database, the lock in the database is not removed and the slave connot acquire the database lock.after the network recovery connection ,the master still can't acquire lock to the database  so now, we have two slaves and no master.period of time , the master process automatically exit,remaining a slave.Any other idea which can solve the network failure test ?
                
> JDBC Master/Slave : Slave cannot acquire lock when the master loose database connection.
> ----------------------------------------------------------------------------------------
>
>                 Key: AMQ-3654
>                 URL: https://issues.apache.org/jira/browse/AMQ-3654
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.5.0
>         Environment: Unix/Redhat 5.6
> ActiveMQ 5.5.0
> Oracle 10G
>            Reporter: Richard Martin
>            Priority: Critical
>             Fix For: 5.7.0
>
>
> Our configuration is JDBC Master/Slave with one master and one slave. When the master is started, he acquire the database lock.
> Then when the slave is started, he wait to acquire the database lock. When the master loose the network connection to the database, the lock in the database is not removed and the slave connot acquire the database lock. In this situation, the master is unable to respond to client (due to network failure)
> and the slave is not started because he can't acquire the database lock.
> When the master is killed, the slave can't acquire the database lock too. After the network connection is restored, when the master starts, it cannot
> acquire lock to the database (because the lod lock is always present) so now, we have two slaves and no master.
> Please, refer to this issue which is the same problem : AMQ-1958 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Commented] (AMQ-3654) JDBC Master/Slave : Slave cannot acquire lock when the master loose database connection.

Posted by pimperator <er...@br.de>.
Hi Guys, 

I also do have the same problem with a loadbalanced mysql master-slave
replication.

The OS on the DB-Servers is RHEL 6.1 with kernel 2.6.32-220.2.1.el6.x86_64
which works with MySQL Version 
Arch        : x86_64
Version     : 5.1.52
Release     : 1.el6_0.1


The ActiveMQ-Servers are working with 
RHEL 6.2 2.6.32-220.7.1.el6.x86_64
with Java
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.6)
(rhel-1.43.1.10.6.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

with Active MQ
Version     : 5.5.1
Release     : 1.el6

with MySQL-Connector mysql-connector-java-5.1.18-bin.jar

I am very interested in a solution and therefor I have set up an identical
environment for testing. Unfortunately in my environment-system this failure
never exceeds :S

Here is my log from activemq-master:

{code}
2012-06-08 15:24:07,396 | ERROR | Failed to update database lock:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link
failure

The last packet successfully received from the server was 29.995
milliseconds ago.  The last packet sent successfully to the server was 0
milliseconds ago. | org.apache.activemq.store.jdbc.DefaultDatabaseLocker |
ActiveMQ Cleanup Timer
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link
failure

The last packet successfully received from the server was 29.995
milliseconds ago.  The last packet sent successfully to the server was 0
milliseconds ago.
        at sun.reflect.GeneratedConstructorAccessor16.newInstance(Unknown
Source)
        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:411)
        at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3102)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2991)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3532)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
        at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
        at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
        at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
        at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
        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.DefaultDatabaseLocker.keepAlive(DefaultDatabaseLocker.java:161)
        at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.databaseLockKeepAlive(JDBCPersistenceAdapter.java:605)
        at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter$3.run(JDBCPersistenceAdapter.java:291)
        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:679)
Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:185)
        at
com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
        at
com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
        at
com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2549)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3002)
        ... 22 more
2012-06-08 15:24:07,397 | INFO  | No longer able to keep the exclusive lock
so giving up being a master |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | ActiveMQ Cleanup
Timer
2012-06-08 15:24:07,397 | INFO  | ActiveMQ Message Broker
(persistent-broker, ID:host2) is shutting down |
org.apache.activemq.broker.BrokerService | ActiveMQ Cleanup Timer
2012-06-08 15:24:08,965 | INFO  | Connector nio Stopped |
org.apache.activemq.broker.TransportConnector | ActiveMQ Cleanup Timer
2012-06-08 15:24:09,543 | INFO  | Connector openwire Stopped |
org.apache.activemq.broker.TransportConnector | ActiveMQ Cleanup Timer
2012-06-08 15:24:09,558 | INFO  |
PListStore:/local/activemq/activemq-instance-persistent-broker/data/persistent-broker/tmp_storage
stopped | org.apache.activemq.store.kahadb.plist.PListStore | ActiveMQ
Cleanup Timer
2012-06-08 15:24:09,561 | INFO  | ActiveMQ JMS Message Broker
(persistent-broker, ID:host2 stopped |
org.apache.activemq.broker.BrokerService | ActiveMQ Cleanup Timer
2012-06-08 15:26:28,469 | INFO  | Refreshing
org.apache.activemq.xbean.XBeanBrokerFactory$1@313a53d: startup date [Fri
Jun 08 15:26:28 CEST 2012]; root of context hierarchy |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2012-06-08 15:26:29,508 | WARN  | destroyApplicationContextOnStop parameter
is deprecated, please use shutdown hooks instead |
org.apache.activemq.xbean.XBeanBrokerService | main
2012-06-08 15:26:29,512 | INFO  |
PListStore:/local/activemq/activemq-instance-persistent-broker/data/persistent-broker/tmp_storage
started | org.apache.activemq.store.kahadb.plist.PListStore | main
2012-06-08 15:26:29,539 | INFO  | Using Persistence Adapter:
JDBCPersistenceAdapter(org.apache.commons.dbcp.BasicDataSource@d6d835f) |
org.apache.activemq.broker.BrokerService | main
2012-06-08 15:26:33,529 | INFO  | Database adapter driver override
recognized for : [mysql-ab_jdbc_driver] - adapter: class
org.apache.activemq.store.jdbc.adapter.MySqlJDBCAdapter |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
2012-06-08 15:27:25,624 | INFO  | Database lock driver override not found
for : [mysql-ab_jdbc_driver].  Will use default implementation. |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
2012-06-08 15:27:25,626 | INFO  | Attempting to acquire the exclusive lock
to become the Master broker |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2012-06-08 15:28:16,616 | INFO  | Failed to acquire lock.  Sleeping for 1000
milli(s) before trying again... |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2012-06-08 15:29:08,685 | INFO  | Failed to acquire lock.  Sleeping for 1000
milli(s) before trying again... |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2012-06-08 15:30:00,752 | INFO  | Failed to acquire lock.  Sleeping for 1000
milli(s) before trying again... |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main

--
View this message in context: http://activemq.2283324.n4.nabble.com/jira-Created-AMQ-3654-JDBC-Master-Slave-Slave-cannot-acquire-lock-when-the-master-loose-database-con-tp4269686p4653158.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.