Message lost and duplication with multiple consumers
----------------------------------------------------
Key: AMQ-1295
URL: https://issues.apache.org/activemq/browse/AMQ-1295
Project: ActiveMQ
Issue Type: Bug
Components: Broker
Affects Versions: 5.0.0
Environment: Standalone broker, Oracle JDBC, no journal persistence.
Reporter: Manuel Teira
Attachments: JMSTestCP.java, planb.xml
Not sure about the exact conditions triggering this bug, but I was able to
reproduce it multiple times using the attached client. What the client does is:
-Opens a connection.
-Creates a configurable number of threads to play the role of consumers in a
given queue.
-The consumer creates a transacted session and fetches messages using a
JMSConsumer.
-Creates a configurable number of threads to play the role of producers in the
given queue.
-Every consumer sends a given amount of messages to the queue, opening a
AUTO_ACKNOWLEDGE session and a JMSProducer to send them.
The bug was detected running two clients simultaneously, with the configuration:
- 1 Producer
- 10 Consumers
- 1000 Messages
Sometimes one or two messages weren't delivered to the consumers. Running a new
client on the same queue didn't help. The only way to get the "frozen" messages
delivered was restarting the browser.
On other situations, some message was delivered twice. This was seen as the JMX
console reported a queuesize = -2, and dequeuecount = enqueuecount + 2. Also, a
counter in the client updated for every received message shown the wrong count
of messages.รง
The situation is hard or imposible to reproduce if:
- You disable completely persistence.
- You add some synchronized code in the client, between the lines:
msg = consumer.receive(2000),
session.commit();
like the commented statement incrConsumedCount(), perhaps shortening the
probability of a race condition.
- You run only a client at once (perhaps the problem only happens with
consumers from different connections simultaneously)
- If you don't use multicast to connect to the broker. I'm using, as
jndi.properties:
java.naming.provider.url = discovery:(multicast://planb.llu.xxxx)
and the same discoveryUri in a openwire connector in the broker. I'm attaching
the client I've used and the configuration to reproduce the problem.
- I was not able to reproduce it using 4.1.1
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.