You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Aaron Pieper (JIRA)" <ji...@apache.org> on 2008/10/01 16:46:52 UTC

[jira] Created: (AMQ-1961) Creating two consumers one after the other causes problems dequeuing messages

Creating two consumers one after the other causes problems dequeuing messages
-----------------------------------------------------------------------------

                 Key: AMQ-1961
                 URL: https://issues.apache.org/activemq/browse/AMQ-1961
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.1.0
            Reporter: Aaron Pieper
         Attachments: EnqueueDequeueBug.java

I create a vm queue with ten messages. I then create a consumer, dequeue the top message (message #1), and close that consumer. If I then create a second consumer, and try to dequeue the top message (message #2), there is a small chance that this will unexpectedly fail, and the request will time out. This is one problem.

After this happens, examining the queue with a queue browser shows message #2 still on the queue. However, subsequent attempts to dequeue this message will always time out. Messages #3-10 will be in the same state; they will still be in the queue, but they cannot be dequeued. This is a worse problem, as it means that we can not reuse this queue.

The problem arises more frequently as there are more consumers. With two or three consumers, it comes up sporadically. With twenty or more consumers, it happens almost 100% of the time. I've attached a test case which demonstrates the bug consistenty.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-1961) Creating two consumers one after the other causes problems dequeuing messages

Posted by "Aaron Pieper (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-1961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46105#action_46105 ] 

Aaron Pieper commented on AMQ-1961:
-----------------------------------

Thanks for your reply. Disabling prefetch for queues fixes the problem. Waiting a few seconds before closing each consumer works also.

So this works as designed then? If you close one consumer, open a second consumer and retrieve a message, the expected behavior is that the message should occasionally be permanently "locked" by the closed consumer?

> Creating two consumers one after the other causes problems dequeuing messages
> -----------------------------------------------------------------------------
>
>                 Key: AMQ-1961
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1961
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.1.0
>            Reporter: Aaron Pieper
>         Attachments: EnqueueDequeueBug.java
>
>
> I create a vm queue with ten messages. I then create a consumer, dequeue the top message (message #1), and close that consumer. If I then create a second consumer, and try to dequeue the top message (message #2), there is a small chance that this will unexpectedly fail, and the request will time out. This is one problem.
> After this happens, examining the queue with a queue browser shows message #2 still on the queue. However, subsequent attempts to dequeue this message will always time out. Messages #3-10 will be in the same state; they will still be in the queue, but they cannot be dequeued. This is a worse problem, as it means that we can not reuse this queue.
> The problem arises more frequently as there are more consumers. With two or three consumers, it comes up sporadically. With twenty or more consumers, it happens almost 100% of the time. I've attached a test case which demonstrates the bug consistenty.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-1961) Creating two consumers one after the other causes problems dequeuing messages

Posted by "James Strachan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Strachan resolved AMQ-1961.
---------------------------------

    Resolution: Fixed

I don't think this is a bug, just a misunderstanding or misconfiguration of the prefetch size...

http://activemq.apache.org/what-is-the-prefetch-limit-for.html

setting a prefetch size of 1 or zero should fix your issue - or waiting long enough for messages to be redispatched to the closed consumer.

> Creating two consumers one after the other causes problems dequeuing messages
> -----------------------------------------------------------------------------
>
>                 Key: AMQ-1961
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1961
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.1.0
>            Reporter: Aaron Pieper
>         Attachments: EnqueueDequeueBug.java
>
>
> I create a vm queue with ten messages. I then create a consumer, dequeue the top message (message #1), and close that consumer. If I then create a second consumer, and try to dequeue the top message (message #2), there is a small chance that this will unexpectedly fail, and the request will time out. This is one problem.
> After this happens, examining the queue with a queue browser shows message #2 still on the queue. However, subsequent attempts to dequeue this message will always time out. Messages #3-10 will be in the same state; they will still be in the queue, but they cannot be dequeued. This is a worse problem, as it means that we can not reuse this queue.
> The problem arises more frequently as there are more consumers. With two or three consumers, it comes up sporadically. With twenty or more consumers, it happens almost 100% of the time. I've attached a test case which demonstrates the bug consistenty.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.