You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by masterov <al...@us.icap.com> on 2007/01/26 21:17:17 UTC

activemq-cpp missing messages

two producers publish to the same topic. Each publishes 10000 messages.  Two
consumers listen on that topic.  Both consumers receive equal number of
messages which in total is less than 20000 (i.e. 19135 <- this number is
different every time) .

What could be the problem?

-- 
View this message in context: http://www.nabble.com/activemq-cpp-missing-messages-tf3124967.html#a8658100
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: activemq-cpp missing messages

Posted by masterov <al...@us.icap.com>.


masterov wrote:
> 
> two producers publish to the same topic. Each publishes 10000 messages. 
> Two consumers listen on that topic.  Both consumers receive equal number
> of messages which in total is less than 20000 (i.e. 19135 <- this number
> is different every time) .
> 

there is also the following exception at the broker:

2007-01-26 15:26:18,790 INFO  [STDOUT] 15:26:16,589 ERROR [Service] Async
error occurred: java.lang.IllegalArg
umentException: The subscription does not exist:
ID:USHSPROGWK317-4071-1169841381167-5:3:-1:1
java.lang.IllegalArgumentException: The subscription does not exist:
ID:USHSPROGWK317-4071-1169841381167-5:3:-
1:1
        at
org.apache.activemq.broker.region.AbstractRegion.acknowledge(AbstractRegion.java:298)
        at
org.apache.activemq.broker.region.RegionBroker.acknowledge(RegionBroker.java:400)
        at
org.apache.activemq.broker.TransactionBroker.acknowledge(TransactionBroker.java:177)
        at
org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:74)
        at
org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:74)
        at
org.apache.activemq.broker.MutableBrokerFilter.acknowledge(MutableBrokerFilter.java:88)
        at
org.apache.activemq.broker.TransportConnection.processMessageAck(TransportConnection.java:491)
        at org.apache.activemq.command.MessageAck.visit(MessageAck.java:179)
        at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:287)
        at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:65)
        at
org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
        at
org.apache.activemq.transport.stomp.StompTransportFilter.sendToActiveMQ(StompTransportFilter.java:7
4)
        at
org.apache.activemq.transport.stomp.StompSubscription.onMessageDispatch(StompSubscription.java:71)
        at
org.apache.activemq.transport.stomp.ProtocolConverter.onActiveMQCommad(ProtocolConverter.java:479)
        at
org.apache.activemq.transport.stomp.StompTransportFilter.oneway(StompTransportFilter.java:56)
        at
org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:141)
        at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:43)
        at
org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:1054)
        at
org.apache.activemq.broker.TransportConnection.processDispatch(TransportConnection.java:775)
        at
org.apache.activemq.broker.TransportConnection.iterate(TransportConnection.java:791)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:111)
        at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:26)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

-- 
View this message in context: http://www.nabble.com/activemq-cpp-missing-messages-tf3124967.html#a8658260
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: activemq-cpp missing messages

Posted by masterov <al...@us.icap.com>.
Right after I posted this, I found the solution.  It turns out that my sample
process terminates before the AMQ thread finishes all the sends, so it
doesn't have a chance to send all the messages, if the process lives long
enough, all messages are sent.  Apologies for the confusion.

Thanks,
AM

-- 
View this message in context: http://www.nabble.com/activemq-cpp-missing-messages-tf3124967.html#a8691619
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: activemq-cpp missing messages

Posted by masterov <al...@us.icap.com>.
Hey,


nmittler wrote:
> 
> Could you write a sample main that illustrates the problem?  Perhaps you
> could put your two consumers and two producers in the same app, but each
> using their own connection?  You could use the AMQCPP concurrent package
> to
> help simplify the threading of the producers.
> 
> Also, what is your environment?
> - broker version?
> - OS/compiler?
> 

I am trying to avoid using threads, so specifically don't want to put
consumers and producers in the same process.  Also - it turns out that if
you give enough load to just one consumer and one producer it misses
messages as well.  Here is all you need to simulate a problem.  
http://www.nabble.com/file/6018/amq_client.tar.gz amq_client.tar.gz 
Just change the Makefile -L to point to location of your libactivemq-cpp.a,
instead of /home/amasterov/lib. Here is the compiler/os info:

> g++ -v      
Using built-in specs.
Target: sparc-sun-solaris2.8
Configured with: ../../src/gcc-4.1.1/configure --disable-nls --enable-shared
--enable-threads=posix --enable-languages=c,c++
--prefix=/export/local8/gcc-4.1.1
Thread model: posix
gcc version 4.1.1

broker: ActiveMQ 4.1.0-incubator (binary), running on a windows machine.

once it compiles, run 1 ./rcv_process and 1 ./snd_process, or to make things
worse, you can run two ./snd_process 'es with a parameter to send 10000
messages each.  the receiving process will terminate once it receives 20000
messages.

Thanks a lot,
AM

-- 
View this message in context: http://www.nabble.com/activemq-cpp-missing-messages-tf3124967.html#a8691479
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: activemq-cpp missing messages

Posted by Nathan Mittler <na...@gmail.com>.
Could you write a sample main that illustrates the problem?  Perhaps you
could put your two consumers and two producers in the same app, but each
using their own connection?  You could use the AMQCPP concurrent package to
help simplify the threading of the producers.

Also, what is your environment?
- broker version?
- OS/compiler?

Thanks!

On 1/26/07, masterov <al...@us.icap.com> wrote:
>
>
>
> tabish121 wrote:
> >
> > Are these all in the same app?  What's keeping the consumers around
> > longer enough to receive all those messages?
> >
> > Sample code?
> >
>
> 1. different apps
> 2. while (1) sleep(10);
> 3. here ya go:
>
>          // Create a ConnectionFactory
>          ActiveMQConnectionFactory* connectionFactory = new
> ActiveMQConnectionFactory(url);
>
>          // Create a Connection
>          connection = connectionFactory->createConnection();
>          connection->start();
>
>          // Create a Session
>          session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
>
>          // Create the control topic
>          control = session->createTopic( "DEV.LOG" );
>
>          // Create a MessageConsumer from the Session to the Topic
>          consumer = session->createConsumer( control );
>          consumer->setMessageListener( this );
>
> and onMessage simply does: count++;
>
> --
> View this message in context:
> http://www.nabble.com/activemq-cpp-missing-messages-tf3124967.html#a8658968
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

RE: activemq-cpp missing messages

Posted by masterov <al...@us.icap.com>.

tabish121 wrote:
> 
> Are these all in the same app?  What's keeping the consumers around
> longer enough to receive all those messages?  
> 
> Sample code?
> 

1. different apps
2. while (1) sleep(10);
3. here ya go:

	 // Create a ConnectionFactory
	 ActiveMQConnectionFactory* connectionFactory = new
ActiveMQConnectionFactory(url);

	 // Create a Connection
	 connection = connectionFactory->createConnection();
	 connection->start();

	 // Create a Session
	 session = connection->createSession( Session::AUTO_ACKNOWLEDGE );

	 // Create the control topic
	 control = session->createTopic( "DEV.LOG" );

	 // Create a MessageConsumer from the Session to the Topic
	 consumer = session->createConsumer( control );
	 consumer->setMessageListener( this );

and onMessage simply does: count++;

-- 
View this message in context: http://www.nabble.com/activemq-cpp-missing-messages-tf3124967.html#a8658968
Sent from the ActiveMQ - User mailing list archive at Nabble.com.