You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by farhad <me...@farhad.eu> on 2011/07/04 17:24:59 UTC
Fail to acquire lock. Stays as "slave"
Hi,
We've been running activemq embedded brokers (5.4.2) with jboss 6.0 for a
while now without any problems. We've been using four brokers in a
master/slave configuration mixed with broker networks topoloy.
Now we are going to run activemq 5.5.0 as sandalone broker. In the meantime
we have an odd problem which apparantly should have been resolved in
previous versions, but still show up in v. 5.5.0. Here is a short
description of the problem when running with a single broker:
- When booting the server machine, the activemq broker comes up and acquire
the lock to the database, becomes the master and voila.
- When you stop the broker, and restart it, then the broker is unable to
acquire the lock and stays as slave. There is no error when stopping the
broker:
-----------------------------------------------
# /etc/init.d/activemq stop
Shutting down ActiveMQ: INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/local/java/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid
'3195' :
Java Runtime: Sun Microsystems Inc. 1.6.0_16 /usr/local/jdk1.6.0_16/jre
Heap sizes: current=251264k free=249951k max=251264k
JVM args: -Xms256M -Xmx256M
-Dorg.apache.activemq.UseDedicatedTaskRunner=true
-Djava.util.logging.config.file=logging.properties
-Dactivemq.classpath=/usr/local/activemq/conf;
-Dactivemq.home=/usr/local/activemq -Dactivemq.base=/usr/local/activemq
ACTIVEMQ_HOME: /usr/local/activemq
ACTIVEMQ_BASE: /usr/local/activemq
Connecting to pid: 3195
Stopping broker: satellite1
. FINISHED
[ OK ]
-----------------------------------------------
Although jconsole tell that the broker is "slave", I am able to send
messages to it and they get stored in the database!!
Here is the setup:
Server: Linux qa1.dibs.dk 2.6.32-131.4.1.el6.x86_64 #1 SMP Fri Jun 10
10:54:26 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
Database: mysql Ver 14.14 Distrib 5.1.52, for redhat-linux-gnu (x86_64)
using readline 5.1
Mysql driver: mysql-connector-java-5.1.13.jar
Activemq: 5.5.0
Java: 1.6.0_16
activemq.xml:
file:${activemq.base}/conf/credentials.properties
">
===============================================
Log messages when activemq is restarted:
-----------------------------------------------------
2011-07-04 16:02:44,655 | INFO | Refreshing
org.apache.activemq.xbean.XBeanBrokerFactory$1@6f25844f: startup date [Mon
Jul 04 16:02:44 CEST 2011]; root of context hierarchy |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2011-07-04 16:02:45,395 | INFO |
PListStore:/usr/local/activemq/data/satellite1/tmp_storage started |
org.apache.activemq.store.kahadb.plist.PListStore | main
2011-07-04 16:02:45,478 | INFO | JMX consoles can connect to
service:jmx:rmi://localhost:11098/jndi/rmi://localhost:11099/jmxrmi |
org.apache.activemq.broker.jmx.ManagementContext | JMX connector
2011-07-04 16:02:45,481 | INFO | Using Persistence Adapter:
JDBCPersistenceAdapter(org.apache.commons.dbcp.BasicDataSource@6d46b6db) |
org.apache.activemq.broker.BrokerService | main
2011-07-04 16:02:45,746 | 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
2011-07-04 16:03:36,840 | INFO | Database lock driver override not found
for : [mysql-ab_jdbc_driver]. Will use default implementation. |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
2011-07-04 16:03:36,842 | INFO | Attempting to acquire the exclusive lock
to become the Master broker |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2011-07-04 16:04:27,862 | INFO | Failed to acquire lock. Sleeping for 1000
milli(s) before trying again... |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
.....
-----------------------------------------------------
I'd appreciate any help,
-Farhad
--
View this message in context: http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3643888.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Fail to acquire lock. Stays as "slave"
Posted by farhad <me...@farhad.eu>.
Hi Gary,
I set the logging level to DEBUG and after restarting, the log shows that
the select and update query for the ACTIVEMQ_LOCK times out. Here is the
exception:
----------------------------------------
2011-07-05 09:12:01,217 | INFO | Database lock driver override not found
for : [mysql-ab_jdbc_driver]. Will use default implementation. |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
2011-07-05 09:12:01,218 | DEBUG | Using default JDBC Locker:
org.apache.activemq.store.jdbc.DefaultDatabaseLocker@40363068 |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
2011-07-05 09:12:01,218 | INFO | Attempting to acquire the exclusive lock
to become the Master broker |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2011-07-05 09:12:01,218 | DEBUG | Locking Query is SELECT * FROM
ACTIVEMQ_LOCK FOR UPDATE |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2011-07-05 09:12:52,019 | DEBUG | Lock failure: java.sql.SQLException: Lock
wait timeout exceeded; try restarting transaction |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
java.sql.SQLException: Lock wait timeout exceeded; try restarting
transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:1553)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1409)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2875)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:476)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2581)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1757)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2171)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1364)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
at
org.apache.activemq.store.jdbc.DefaultDatabaseLocker.start(DefaultDatabaseLocker.java:73)
at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:287)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:493)
at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
at
org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:114)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:114)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:70)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
at
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:143)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
at org.apache.activemq.console.Main.main(Main.java:107)
2011-07-05 09:12:52,021 | DEBUG | Caught while closing statement:
java.sql.SQLException: Already closed |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
java.sql.SQLException: Already closed
at
org.apache.commons.dbcp.PoolablePreparedStatement.close(PoolablePreparedStatement.java:76)
at
org.apache.commons.dbcp.DelegatingStatement.close(DelegatingStatement.java:168)
at
org.apache.activemq.store.jdbc.DefaultDatabaseLocker.start(DefaultDatabaseLocker.java:115)
at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:287)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:493)
at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
.....
2011-07-05 09:20:40,506 | INFO | Failed to acquire lock. Sleeping for 1000
milli(s) before trying again... |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
-------------------------------------------
The jconsole tells the broker is in slave state, though i'm not sure that
the information given by jconsole is accurate, since when i try to check the
attributes of the broker in jconsole, the following exceptions are thrown in
the broker's log:
-------------------------------------------
2011-07-05 09:21:59,246 | DEBUG | Failed to read URI to build
transportURIsAsMap | org.apache.activemq.broker.BrokerService | RMI TCP
Connection(8)-192.168.11.192
java.lang.NullPointerException
at
org.apache.activemq.broker.BrokerService.getTransportConnectorURIsAsMap(BrokerService.java:1109)
at
org.apache.activemq.broker.jmx.BrokerView.getOpenWireURL(BrokerView.java:318)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
at
com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
at
com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
at com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:65)
at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:216)
at
com.sun.jmx.mbeanserver.MBeanSupport.getAttributes(MBeanSupport.java:223)
at javax.management.StandardMBean.getAttributes(StandardMBean.java:376)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttributes(DefaultMBeanServerInterceptor.java:726)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.getAttributes(JmxMBeanServer.java:665)
at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at
javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1359)
at
javax.management.remote.rmi.RMIConnectionImpl.getAttributes(RMIConnectionImpl.java:636)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
2011-07-05 09:21:59,247 | DEBUG | Failed to read URI to build
transportURIsAsMap | org.apache.activemq.broker.BrokerService | RMI TCP
Connection(8)-192.168.11.192
java.lang.NullPointerException
at
org.apache.activemq.broker.BrokerService.getTransportConnectorURIsAsMap(BrokerService.java:1109)
at org.apache.activemq.broker.jmx.BrokerView.getSslURL(BrokerView.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
......
--------------------------------------------------------------------
Here is a snapshot of the broker's attributes in jconsole.
http://activemq.2283324.n4.nabble.com/file/n3645301/activemq.png
----------
Then i tried to fire against the broker and here is the output:
> mvn exec:java -Pproducer -Dtransacted=true -Dp.sleep.time=500
> -Dmessage.count=100 -Dbroker.url=tcp://192.168.11.107:61616
.....
[05/Jul/2011 09:13:39] DEBUG WireFormatNegotiator -
tcp:///192.168.11.107:61616 before negotiation: OpenWireFormat{version=7,
cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false,
sizePrefixDisabled=false}
[05/Jul/2011 09:13:39] DEBUG WireFormatNegotiator -
tcp:///192.168.11.107:61616 after negotiation: OpenWireFormat{version=6,
cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true,
sizePrefixDisabled=false}
[05/Jul/2011 09:13:39] DEBUG JmsTemplate - Executing callback on JMS
Session: PooledSession { ActiveMQSession
{id=ID:fade-cpu-57842-1309850019654-0:1:1,started=false} }
[05/Jul/2011 09:13:39] DEBUG JmsTemplate - Sending created message:
ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
null, originalDestination = null, originalTransactionId = null, producerId =
null, destination = null, transactionId = null, expiration = 0, timestamp =
0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
replyTo = null, persistent = false, type = null, priority = 0, groupID =
null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
false, readOnlyBody = false, droppable = false, text = Message: 0 sent at:
Tue Jul 05 09:13:39 CEST ... ...}
[05/Jul/2011 09:13:39] DEBUG TransactionContext -
Begin:TX:ID:fade-cpu-57842-1309850019654-0:1:1
[05/Jul/2011 09:13:39] DEBUG ActiveMQSession -
ID:fade-cpu-57842-1309850019654-0:1:1 Transaction Commit
:TX:ID:fade-cpu-57842-1309850019654-0:1:1
[05/Jul/2011 09:13:39] DEBUG TransactionContext - Commit:
TX:ID:fade-cpu-57842-1309850019654-0:1:1 syncCount: 0
[05/Jul/2011 09:13:39] DEBUG ActiveMQSession -
ID:fade-cpu-57842-1309850019654-0:1:1 Transaction Rollback
[05/Jul/2011 09:13:40] INFO AmqProducer - [Thread-2] Sending message:
'Message: 1 sent at: Tue Jul 05 09:13:40 CEST 2011
...'
[05/Jul/2011 09:13:40] DEBUG JmsTemplate - Executing callback on JMS
Session: PooledSession { ActiveMQSession
{id=ID:fade-cpu-57842-1309850019654-0:1:1,started=false} }
[05/Jul/2011 09:13:40] DEBUG JmsTemplate - Sending created message:
ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
null, originalDestination = null, originalTransactionId = null, producerId =
null, destination = null, transactionId = null, expiration = 0, timestamp =
0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
replyTo = null, persistent = false, type = null, priority = 0, groupID =
null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
false, readOnlyBody = false, droppable = false, text = Message: 1 sent at:
Tue Jul 05 09:13:40 CEST ... ...}
[05/Jul/2011 09:13:40] DEBUG TransactionContext -
Begin:TX:ID:fade-cpu-57842-1309850019654-0:1:2
[05/Jul/2011 09:13:40] DEBUG ActiveMQSession -
ID:fade-cpu-57842-1309850019654-0:1:1 Transaction Commit
:TX:ID:fade-cpu-57842-1309850019654-0:1:2
[05/Jul/2011 09:13:40] DEBUG TransactionContext - Commit:
TX:ID:fade-cpu-57842-1309850019654-0:1:2 syncCount: 0
[05/Jul/2011 09:13:40] DEBUG ActiveMQSession -
ID:fade-cpu-57842-1309850019654-0:1:1 Transaction Rollback
[05/Jul/2011 09:13:40] INFO AmqProducer - [Thread-2] Sending message:
'Message: 2 sent at: Tue Jul 05 09:13:40 CEST 2011
...'
[05/Jul/2011 09:13:40] DEBUG JmsTemplate - Executing callback on JMS
Session: PooledSession { ActiveMQSession
{id=ID:fade-cpu-57842-1309850019654-0:1:1,started=false} }
....
---------------------------------------------------------------
I'm not quite sure how to understand the following three lines coming up
after sending each message:
[05/Jul/2011 09:13:40] DEBUG ActiveMQSession -
ID:fade-cpu-57842-1309850019654-0:1:1 Transaction Commit
:TX:ID:fade-cpu-57842-1309850019654-0:1:2
[05/Jul/2011 09:13:40] DEBUG TransactionContext - Commit:
TX:ID:fade-cpu-57842-1309850019654-0:1:2 syncCount: 0
[05/Jul/2011 09:13:40] DEBUG ActiveMQSession -
ID:fade-cpu-57842-1309850019654-0:1:1 Transaction Rollback
Do we have a commit or rollback here ?!! Not very clear what activemq mean.
The messages get persisted in the brokers database anyway.
Regards,
-Farhad
--
View this message in context: http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3645301.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Fail to acquire lock. Stays as "slave"
Posted by Gary Tully <ga...@gmail.com>.
maybe try enabling trace level logging via log4j.properties and see if
there is anything more in the log.
You can reproduce this, right?
On 4 July 2011 17:01, farhad <me...@farhad.eu> wrote:
> Hi Gary,
> Yes, I know, its very odd. But both jconsole and the log say that the broker
> is 'slave'!!?
> Regards, Farhad
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3643961.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
--
http://fusesource.com
http://blog.garytully.com
Re: Fail to acquire lock. Stays as "slave"
Posted by farhad <me...@farhad.eu>.
Hi Gary,
Yes, I know, its very odd. But both jconsole and the log say that the broker
is 'slave'!!?
Regards, Farhad
--
View this message in context: http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3643961.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Fail to acquire lock. Stays as "slave"
Posted by Gary Tully <ga...@gmail.com>.
That is very odd, if the lock acquire fails, the network adapters are
not started, so you should not be able to connect to the broker with a
jms client to send messages.
On 4 July 2011 16:31, farhad <me...@farhad.eu> wrote:
> Hi,
> Sorry for the previous email. Here it is in a readable format:
> We've been running activemq embedded brokers (5.4.2) with jboss 6.0 for a
> while now without any problems. We've been using four brokers in a
> master/slave configuration mixed with broker networks topoloy.
> Now we are going to run activemq 5.5.0 as sandalone broker. In the meantime
> we have an odd problem which apparantly should have been resolved in
> previous versions, but still show up in v. 5.5.0. Here is a short
> description of the problem when running with a single broker:
> - When booting the server machine, the activemq broker comes up and acquire
> the lock to the database, becomes the master and voila.
> - When you stop the broker, and restart it, then the broker is unable to
> acquire the lock and stays as slave. There is no error when stopping the
> broker:
> -----------------------------------------------
> # /etc/init.d/activemq stop
> Shutting down ActiveMQ: INFO: Loading '/etc/default/activemq'
> INFO: Using java '/usr/local/java/bin/java'
> INFO: Waiting at least 30 seconds for regular process termination of pid
> '3195' :
> Java Runtime: Sun Microsystems Inc. 1.6.0_16 /usr/local/jdk1.6.0_16/jre
> Heap sizes: current=251264k free=249951k max=251264k
> JVM args: -Xms256M -Xmx256M
> -Dorg.apache.activemq.UseDedicatedTaskRunner=true
> -Djava.util.logging.config.file=logging.properties
> -Dactivemq.classpath=/usr/local/activemq/conf;
> -Dactivemq.home=/usr/local/activemq -Dactivemq.base=/usr/local/activemq
> ACTIVEMQ_HOME: /usr/local/activemq
> ACTIVEMQ_BASE: /usr/local/activemq
> Connecting to pid: 3195
> Stopping broker: satellite1
> . FINISHED
> [ OK ]
> -----------------------------------------------
> Although jconsole tell that the broker is "slave", I am able to send
> messages to it and they get stored in the database!!
>
> Here is the setup:
> Server: Linux qa1.dibs.dk 2.6.32-131.4.1.el6.x86_64 #1 SMP Fri Jun 10
> 10:54:26 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
> Database: mysql Ver 14.14 Distrib 5.1.52, for redhat-linux-gnu (x86_64)
> using readline 5.1
> Mysql driver: mysql-connector-java-5.1.13.jar
> Activemq: 5.5.0
> Java: 1.6.0_16
>
> activemq.xml:
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd">
>
> <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
> <property name="locations">
> <value>file:${activemq.base}/conf/credentials.properties</value>
> </property>
> </bean>
>
> <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
> useShutdownHook="false" advisorySupport="true" brokerName="satellite1"
> dataDirectory="${activemq.base}/data">
>
> <destinationPolicy>
> <policyMap>
> <policyEntries>
> <policyEntry queue=">">
> <deadLetterStrategy>
> <sharedDeadLetterStrategy processExpired="false"
> processNonPersistent="false" />
> </deadLetterStrategy>
> <dispatchPolicy>
> <roundRobinDispatchPolicy />
> </dispatchPolicy>
> </policyEntry>
> </policyEntries>
> </policyMap>
> </destinationPolicy>
>
> <managementContext>
> <managementContext connectorPort="11099" rmiServerPort="11098" />
> </managementContext>
>
>
>
> <persistenceAdapter>
> <jdbcPersistenceAdapter
> dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"/>
> </persistenceAdapter>
>
> <transportConnectors>
> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
> </transportConnectors>
>
> </broker>
>
> <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
> <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> <property name="url"
> value="jdbc:mysql://0.0.0.0:3306/activemq?characterEncoding=utf-8&autoReconnect=true"/>
> <property name="username" value="xxx"/>
> <property name="password" value="xxx"/>
> <property name="poolPreparedStatements" value="true"/>
> </bean>
>
> </beans>
> ===============================================
> Log messages when activemq is restarted:
> -----------------------------------------------------
> 2011-07-04 16:02:44,655 | INFO | Refreshing
> org.apache.activemq.xbean.XBeanBrokerFactory$1@6f25844f: startup date [Mon
> Jul 04 16:02:44 CEST 2011]; root of context hierarchy |
> org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
> 2011-07-04 16:02:45,395 | INFO |
> PListStore:/usr/local/activemq/data/satellite1/tmp_storage started |
> org.apache.activemq.store.kahadb.plist.PListStore | main
> 2011-07-04 16:02:45,478 | INFO | JMX consoles can connect to
> service:jmx:rmi://localhost:11098/jndi/rmi://localhost:11099/jmxrmi |
> org.apache.activemq.broker.jmx.ManagementContext | JMX connector
> 2011-07-04 16:02:45,481 | INFO | Using Persistence Adapter:
> JDBCPersistenceAdapter(org.apache.commons.dbcp.BasicDataSource@6d46b6db) |
> org.apache.activemq.broker.BrokerService | main
> 2011-07-04 16:02:45,746 | 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
> 2011-07-04 16:03:36,840 | INFO | Database lock driver override not found
> for : [mysql-ab_jdbc_driver]. Will use default implementation. |
> org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
> 2011-07-04 16:03:36,842 | INFO | Attempting to acquire the exclusive lock
> to become the Master broker |
> org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
> 2011-07-04 16:04:27,862 | INFO | Failed to acquire lock. Sleeping for 1000
> milli(s) before trying again... |
> org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
> .....
> -----------------------------------------------------
>
> I'd appreciate any help,
> -Farhad
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3643900.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
--
http://fusesource.com
http://blog.garytully.com
Re: Fail to acquire lock. Stays as "slave"
Posted by farhad <me...@farhad.eu>.
Hi,
Sorry for the previous email. Here it is in a readable format:
We've been running activemq embedded brokers (5.4.2) with jboss 6.0 for a
while now without any problems. We've been using four brokers in a
master/slave configuration mixed with broker networks topoloy.
Now we are going to run activemq 5.5.0 as sandalone broker. In the meantime
we have an odd problem which apparantly should have been resolved in
previous versions, but still show up in v. 5.5.0. Here is a short
description of the problem when running with a single broker:
- When booting the server machine, the activemq broker comes up and acquire
the lock to the database, becomes the master and voila.
- When you stop the broker, and restart it, then the broker is unable to
acquire the lock and stays as slave. There is no error when stopping the
broker:
-----------------------------------------------
# /etc/init.d/activemq stop
Shutting down ActiveMQ: INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/local/java/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid
'3195' :
Java Runtime: Sun Microsystems Inc. 1.6.0_16 /usr/local/jdk1.6.0_16/jre
Heap sizes: current=251264k free=249951k max=251264k
JVM args: -Xms256M -Xmx256M
-Dorg.apache.activemq.UseDedicatedTaskRunner=true
-Djava.util.logging.config.file=logging.properties
-Dactivemq.classpath=/usr/local/activemq/conf;
-Dactivemq.home=/usr/local/activemq -Dactivemq.base=/usr/local/activemq
ACTIVEMQ_HOME: /usr/local/activemq
ACTIVEMQ_BASE: /usr/local/activemq
Connecting to pid: 3195
Stopping broker: satellite1
. FINISHED
[ OK ]
-----------------------------------------------
Although jconsole tell that the broker is "slave", I am able to send
messages to it and they get stored in the database!!
Here is the setup:
Server: Linux qa1.dibs.dk 2.6.32-131.4.1.el6.x86_64 #1 SMP Fri Jun 10
10:54:26 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
Database: mysql Ver 14.14 Distrib 5.1.52, for redhat-linux-gnu (x86_64)
using readline 5.1
Mysql driver: mysql-connector-java-5.1.13.jar
Activemq: 5.5.0
Java: 1.6.0_16
activemq.xml:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.base}/conf/credentials.properties</value>
</property>
</bean>
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
useShutdownHook="false" advisorySupport="true" brokerName="satellite1"
dataDirectory="${activemq.base}/data">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue=">">
<deadLetterStrategy>
<sharedDeadLetterStrategy processExpired="false"
processNonPersistent="false" />
</deadLetterStrategy>
<dispatchPolicy>
<roundRobinDispatchPolicy />
</dispatchPolicy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<managementContext>
<managementContext connectorPort="11099" rmiServerPort="11098" />
</managementContext>
<persistenceAdapter>
<jdbcPersistenceAdapter
dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>
</broker>
<bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url"
value="jdbc:mysql://0.0.0.0:3306/activemq?characterEncoding=utf-8&autoReconnect=true"/>
<property name="username" value="xxx"/>
<property name="password" value="xxx"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
</beans>
===============================================
Log messages when activemq is restarted:
-----------------------------------------------------
2011-07-04 16:02:44,655 | INFO | Refreshing
org.apache.activemq.xbean.XBeanBrokerFactory$1@6f25844f: startup date [Mon
Jul 04 16:02:44 CEST 2011]; root of context hierarchy |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2011-07-04 16:02:45,395 | INFO |
PListStore:/usr/local/activemq/data/satellite1/tmp_storage started |
org.apache.activemq.store.kahadb.plist.PListStore | main
2011-07-04 16:02:45,478 | INFO | JMX consoles can connect to
service:jmx:rmi://localhost:11098/jndi/rmi://localhost:11099/jmxrmi |
org.apache.activemq.broker.jmx.ManagementContext | JMX connector
2011-07-04 16:02:45,481 | INFO | Using Persistence Adapter:
JDBCPersistenceAdapter(org.apache.commons.dbcp.BasicDataSource@6d46b6db) |
org.apache.activemq.broker.BrokerService | main
2011-07-04 16:02:45,746 | 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
2011-07-04 16:03:36,840 | INFO | Database lock driver override not found
for : [mysql-ab_jdbc_driver]. Will use default implementation. |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
2011-07-04 16:03:36,842 | INFO | Attempting to acquire the exclusive lock
to become the Master broker |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
2011-07-04 16:04:27,862 | INFO | Failed to acquire lock. Sleeping for 1000
milli(s) before trying again... |
org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
.....
-----------------------------------------------------
I'd appreciate any help,
-Farhad
--
View this message in context: http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3643900.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.