You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by David Sitsky <si...@nuix.com> on 2007/08/23 10:22:13 UTC

Large PendingQueueSize values for subscriptions on a queue with one message

I have an application which is using the latest snapshot of ActiveMQ 5.0.

I have a master JVM process which sends an item to a work-item queue.  I 
have worker JVM processes which pick up these items, process them, and 
possibly create new items into the work-item queue as a part of 
processing these messages.

The master sends a new work-item once the workers have completed all 
their work.

I have a situation where if there is only one worker JVM process (one 
consumer), everything works fine.  If there are two workers, they 
complete all of their work, the master sends the next work item to the 
queue, but they never get notified of this new message.

I know the message is sent, via the JMX console, and that the worker 
subscriptions are still active.

What is strange is the worker's subscriptions have large 
PendingQueueSize values, which seems odd, since they aren't processing 
any more messages.  The queue size is 1 after the master sends its new 
message.

If I create a new worker process, it immediately gets the message from 
the master!

This happens with or without transactions, and with all sorts of 
pre-fetch sizes, using the same or separate Connections.

I've started to run the broker in my IDEA debugger to try and understand 
what is going on - but the fact that the PendingQueueSize are quite 
large, does this explain why the old workers don't get new messages? 
Does this sound like a bug?

Any suggestions on what I should look for?  I'm happy to dive into the 
code, but would appreciate some guidance.

Cheers,
David

Re: Large PendingQueueSize values for subscriptions on a queue with one message

Posted by David Sitsky <si...@nuix.com>.
Hi Rob,

I thought that would be your answer - fair enough.

I've attached a unit test which demonstrates the problem.  I tried to 
make the code as small as possible.

In this situation, the issue (program hangs) seems to happen when 
QUEUE_PREFETCH_SIZE == 1 and NUM_WORKERS = 2 (90% of the time). 
Changing NUM_WORKERS to 1 seems to make it work.

Increasing the QUEUE_PREFETCH_SIZE also seems to make things work.

Thanks for looking into this.  I am really interested to find out what 
the culprit is.  I am a relative novice with JMS, so I wouldn't be 
surprised if it is something I have done wrong.

Cheers,
David

Rob Davies wrote:
> could you build a junit test case to demonstrate this ? This would be 
> most hopeful
> 
> 
> cheers,
> 
> Rob
> 
> 'Go Get Integrated -  ride the Camel! - http://activemq.apache.org/camel/'
> http://rajdavies.blogspot.com/
> 
> 
> 
> On Aug 23, 2007, at 9:22 AM, David Sitsky wrote:
> 
>> I have an application which is using the latest snapshot of ActiveMQ 5.0.
>>
>> I have a master JVM process which sends an item to a work-item queue.  
>> I have worker JVM processes which pick up these items, process them, 
>> and possibly create new items into the work-item queue as a part of 
>> processing these messages.
>>
>> The master sends a new work-item once the workers have completed all 
>> their work.
>>
>> I have a situation where if there is only one worker JVM process (one 
>> consumer), everything works fine.  If there are two workers, they 
>> complete all of their work, the master sends the next work item to the 
>> queue, but they never get notified of this new message.
>>
>> I know the message is sent, via the JMX console, and that the worker 
>> subscriptions are still active.
>>
>> What is strange is the worker's subscriptions have large 
>> PendingQueueSize values, which seems odd, since they aren't processing 
>> any more messages.  The queue size is 1 after the master sends its new 
>> message.
>>
>> If I create a new worker process, it immediately gets the message from 
>> the master!
>>
>> This happens with or without transactions, and with all sorts of 
>> pre-fetch sizes, using the same or separate Connections.
>>
>> I've started to run the broker in my IDEA debugger to try and 
>> understand what is going on - but the fact that the PendingQueueSize 
>> are quite large, does this explain why the old workers don't get new 
>> messages? Does this sound like a bug?
>>
>> Any suggestions on what I should look for?  I'm happy to dive into the 
>> code, but would appreciate some guidance.
>>
>> Cheers,
>> David
> 
> 


-- 
Cheers,
David

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com                            Fax: +61 2 9212 6902

Re: Large PendingQueueSize values for subscriptions on a queue with one message

Posted by Rob Davies <ra...@gmail.com>.
could you build a junit test case to demonstrate this ? This would be  
most hopeful


cheers,

Rob

'Go Get Integrated -  ride the Camel! - http://activemq.apache.org/ 
camel/'
http://rajdavies.blogspot.com/



On Aug 23, 2007, at 9:22 AM, David Sitsky wrote:

> I have an application which is using the latest snapshot of  
> ActiveMQ 5.0.
>
> I have a master JVM process which sends an item to a work-item  
> queue.  I have worker JVM processes which pick up these items,  
> process them, and possibly create new items into the work-item  
> queue as a part of processing these messages.
>
> The master sends a new work-item once the workers have completed  
> all their work.
>
> I have a situation where if there is only one worker JVM process  
> (one consumer), everything works fine.  If there are two workers,  
> they complete all of their work, the master sends the next work  
> item to the queue, but they never get notified of this new message.
>
> I know the message is sent, via the JMX console, and that the  
> worker subscriptions are still active.
>
> What is strange is the worker's subscriptions have large  
> PendingQueueSize values, which seems odd, since they aren't  
> processing any more messages.  The queue size is 1 after the master  
> sends its new message.
>
> If I create a new worker process, it immediately gets the message  
> from the master!
>
> This happens with or without transactions, and with all sorts of  
> pre-fetch sizes, using the same or separate Connections.
>
> I've started to run the broker in my IDEA debugger to try and  
> understand what is going on - but the fact that the  
> PendingQueueSize are quite large, does this explain why the old  
> workers don't get new messages? Does this sound like a bug?
>
> Any suggestions on what I should look for?  I'm happy to dive into  
> the code, but would appreciate some guidance.
>
> Cheers,
> David