-
15. Re: Failed to ack
daroo Oct 1, 2009 4:17 PM (in response to daroo)As I wrote in my initial post pretty similar exception is thrown when my client code has Session.AUTO_ACKNOWLEDGE set on session.
[Thread-5 (group:HornetQ-server-threads22130853-2372025)] 22:02:40,343 SEVERE [org.hornetq.core.server.impl.ServerSessionImpl] Failed to acknowledge java.lang.IllegalStateException: Cannot find add info 18 at org.hornetq.core.journal.impl.JournalImpl.appendUpdateRecord(JournalImpl.java:915) at org.hornetq.core.persistence.impl.journal.JournalStorageManager.storeAcknowledge(JournalStorageManager.java:302) at org.hornetq.core.server.impl.QueueImpl.acknowledge(QueueImpl.java:665) at org.hornetq.core.server.impl.ServerConsumerImpl.acknowledge(ServerConsumerImpl.java:372) at org.hornetq.core.server.impl.ServerSessionImpl.handleAcknowledge(ServerSessionImpl.java:652) at org.hornetq.core.server.impl.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:137) at org.hornetq.core.remoting.impl.ChannelImpl.handlePacket(ChannelImpl.java:492) at org.hornetq.core.remoting.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:384) at org.hornetq.core.remoting.impl.RemotingConnectionImpl.access$000(RemotingConnectionImpl.java:41) at org.hornetq.core.remoting.impl.RemotingConnectionImpl$1.run(RemotingConnectionImpl.java:346) at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Client code:public class FailedToACKCase { private final static String QUEUE_LOCAL_IN_NAME = "QueueLocalIn"; private final static String QUEUE_LOCAL_OUT_NAME = "QueueLocalOut"; private final static Integer ENDPOINT_PORT = 5445; public static void main(String[] args) throws Exception { Connection connection = null; try { connection = buildConnection(ENDPOINT_PORT); final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); //final Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); final MessageProducer producer = session.createProducer(new HornetQQueue(QUEUE_LOCAL_IN_NAME)); final TextMessage message = session.createTextMessage("message text"); producer.send(message); connection.start(); final MessageConsumer consumer = session.createConsumer(new HornetQQueue(QUEUE_LOCAL_OUT_NAME)); TextMessage receivedMessage = (TextMessage) consumer.receive(1000); if (receivedMessage != null) { //receivedMessage.acknowledge(); System.out.println("Received message text: " + receivedMessage.getText()); } } finally { if (connection != null) { connection.close(); } } } private static Connection buildConnection(Integer port) throws JMSException { Map<String, Object> connectionParams = new HashMap<String, Object>(); connectionParams.put(PORT_PROP_NAME, port); TransportConfiguration transportConfiguration = new TransportConfiguration( NettyConnectorFactory.class.getName(), connectionParams); ConnectionFactory cf = new HornetQConnectionFactory(transportConfiguration); return cf.createConnection(); } }
HornetQ configuration:<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd"> <connectors> <connector name="netty"> <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class> <param key="hornetq.remoting.netty.host" value="${hornetq.remoting.netty.host:localhost}" type="String"/> <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/> </connector> </connectors> <acceptors> <acceptor name="netty"> <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class> <param key="hornetq.remoting.netty.host" value="${hornetq.remoting.netty.host:localhost}" type="String"/> <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/> </acceptor> </acceptors> <queues> <queue name="jms.queue.QueueLocalIn"> <address>jms.queue.QueueLocalIn</address> </queue> <queue name="jms.queue.QueueLocalOut"> <address>jms.queue.QueueLocalOut</address> </queue> </queues> <diverts> <divert name="local-divert"> <address>jms.queue.QueueLocalIn</address> <forwarding-address>jms.queue.QueueLocalOut</forwarding-address> <exclusive>true</exclusive> </divert> </diverts> <security-enabled>false</security-enabled> <address-settings> <!--default for catch all--> <address-setting match="#"> <clustered>false</clustered> <dead-letter-address>jms.queue.DLQ</dead-letter-address> <expiry-address>jms.queue.ExpiryQueue</expiry-address> <redelivery-delay>0</redelivery-delay> <max-size-bytes>-1</max-size-bytes> <page-size-bytes>10485760</page-size-bytes> <distribution-policy-class>org.hornetq.core.server.impl.RoundRobinDistributor</distribution-policy-class> <message-counter-history-day-limit>10</message-counter-history-day-limit> </address-setting> </address-settings> <paging-directory>../data/paging</paging-directory> <bindings-directory>../data/bindings</bindings-directory> <journal-directory>../data/journal</journal-directory> <large-messages-directory>../data/large-messages</large-messages-directory> </configuration>
I've also added the two new queues to hornetq-jms.xml<queue name="QueueLocalIn"> <entry name="/queue/QueueLocalIn"/> </queue> <queue name="QueueLocalOut"> <entry name="/queue/QueueLocalOut"/> </queue>
All the other files were not changed. When I change acknowledgment mode to Session.CLIENT_ACKNOWLEDGE everything works fine (no exceptions). -
16. Re: Failed to ack
clebert.suconic Oct 1, 2009 4:46 PM (in response to daroo)I will try to replicate it here.. give me about 1 hour and I will update you here.
Meanwhile.. if you could please send me those source files through email it would be great. -
17. Re: Failed to ack
clebert.suconic Oct 1, 2009 5:17 PM (in response to daroo)You have a divert in your example. There is a high chance of that affecting your problem.
I would need the complete set of files before being able to reproduce anything. And I'm very interested in replicating this...
The easiest would be you sending me that by email. (My email is public here on the forum).
Or at least you could maybe post the code for the Divert.
Thanks, -
18. Re: Failed to ack
clebert.suconic Oct 1, 2009 5:20 PM (in response to daroo)"clebert.suconic@jboss.com" wrote:
Or at least you could maybe post the code for the Divert.
Sorry.. ignore me.. I was thinking of interceptors. -
19. Re: Failed to ack
daroo Oct 1, 2009 5:27 PM (in response to daroo)The simplest case with divert when
SEVERE [org.hornetq.core.server.impl.ServerSessionImpl] Failed to acknowledge java.lang.IllegalStateException: Cannot find add info
is thrown i've already posted here. There is nothing more than few lines of client code and some changes in configuration (everything in my post).
More complicated example (divert and bridge, three standalone instances) I've just sent you by email. That one logs the error shown above as well as my primal oneSEVERE [org.hornetq.core.server.cluster.impl.BridgeImpl] Failed to ack java.lang.IllegalStateException: Cannot find add info
-
20. Re: Failed to ack
clebert.suconic Oct 1, 2009 6:23 PM (in response to daroo)Yes.. a simple divert with AutoACK is failing:
https://jira.jboss.org/jira/browse/HORNETQ-165
I have imported most of your code on this simple test case, at org.hornetq.tests.integration.jms.divert.DivertAndACKClientTest/
If you run the test now, you will see:SEVERE: Failed to acknowledge java.lang.IllegalStateException: Cannot find add info 8 at org.hornetq.core.journal.impl.JournalImpl.appendUpdateRecord(JournalImpl.java:915) at org.hornetq.core.persistence.impl.journal.JournalStorageManager.storeAcknowledge(JournalStorageManager.java:302) at org.hornetq.core.server.impl.QueueImpl.acknowledge(QueueImpl.java:665) at org.hornetq.core.server.impl.ServerConsumerImpl.acknowledge(ServerConsumerImpl.java:372) at org.hornetq.core.server.impl.ServerSessionImpl.handleAcknowledge(ServerSessionImpl.java:652) at org.hornetq.core.server.impl.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:137) at org.hornetq.core.remoting.impl.ChannelImpl.handlePacket(ChannelImpl.java:492) at org.hornetq.core.remoting.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:384) at org.hornetq.core.remoting.impl.RemotingConnectionImpl.access$0(RemotingConnectionImpl.java:354) at org.hornetq.core.remoting.impl.RemotingConnectionImpl$1.run(RemotingConnectionImpl.java:346) at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96) 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)
Right now the test will show as a JUnit pass, just because the ACK is set to be Async, if you set it to block (as I documented on the code) it will show an error on Junit.
We will be investigating this... It should be fixed soon:
https://jira.jboss.org/jira/browse/HORNETQ-165 -
21. Re: Failed to ack
clebert.suconic Oct 1, 2009 6:32 PM (in response to daroo)Just a FYI:
If I set exclusive to false it won't fail, but on that case the Divert is copying the message instead of just storing a reference. -
22. Re: Failed to ack
daroo Oct 2, 2009 3:13 AM (in response to daroo)Thanks a lot for your help and the case investigation.
-
23. Re: Failed to ack
clebert.suconic Oct 8, 2009 11:03 AM (in response to daroo)@daroo: Tim Fox fixed it on trunk. You may want to give a try on trunk.
-
24. Failed to ack
dushmanlk Feb 22, 2011 11:06 PM (in response to daroo)I'm using the 2.0.0.GA release. it seems the bug still exists with diverts
-
25. Failed to ack
clebert.suconic Feb 23, 2011 1:23 AM (in response to dushmanlk)2.0.0.GA is very old.
2.1.0.GA is the latest and 2.2.0.Final is almost out. you should try a build fom trunk.