You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Christopher L. Shannon (JIRA)" <ji...@apache.org> on 2017/01/19 18:14:26 UTC

[jira] [Commented] (AMQ-1940) Negative queue size (reproducible)

    [ https://issues.apache.org/jira/browse/AMQ-1940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15830358#comment-15830358 ] 

Christopher L. Shannon commented on AMQ-1940:
---------------------------------------------

I noticed this issue today when doing a purge.  I believe the issue is that after the messages are removed in the do/while loop inside the queue purge method the statistics counter is reset to 0.  This is a problem because there is nothing preventing messages from being added to the Queue in between message removal and resetting of the counters.  This means it's possible to have new messages in the queue but the counter is set to 0 such that the count will now go negative when those messages acked.

[~gtully], I think the fix is as simple as removing two lines of code on line 1267 and 1268.  https://github.com/apache/activemq/blob/activemq-5.14.3/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java#L1267

I don't see any reason why we should need to reset the messages cursor or the messages statistics counter to 0 at the end if the purge behaves properly as the counter should already be properly decremented when each message is dropped.  What do you think?

> Negative queue size (reproducible)
> ----------------------------------
>
>                 Key: AMQ-1940
>                 URL: https://issues.apache.org/jira/browse/AMQ-1940
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.2.0
>         Environment: Found on Windows but reproduced under Linux
>            Reporter: Vadim Chekan
>            Assignee: Rob Davies
>            Priority: Critical
>             Fix For: 5.3.0
>
>         Attachments: Main.java, Picture 6.png, QueuePurgeTest.java.diff.txt
>
>
> When you "purge" queue from web admin console, it zeroes queue message
> counter. But if you have an active consumer at that time which
> pre-fetched messages than your consumer will keep sending ack as it
> process messages from its buffer. ActiveMQ will keep decrement counter
> upon receiving each ack. So when consumer is done queue will show
> MINUS<consumer buffer size>.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)