Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 83F2817360 for ; Tue, 14 Oct 2014 02:39:35 +0000 (UTC) Received: (qmail 22930 invoked by uid 500); 14 Oct 2014 02:39:35 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 22834 invoked by uid 500); 14 Oct 2014 02:39:35 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 22622 invoked by uid 99); 14 Oct 2014 02:39:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Oct 2014 02:39:35 +0000 Date: Tue, 14 Oct 2014 02:39:35 +0000 (UTC) From: "Gerco Dries (JIRA)" To: dev@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AMQ-5340) QueueBrowser hangs until accidentally woken by expired messages background job MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQ-5340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14170401#comment-14170401 ] Gerco Dries commented on AMQ-5340: ---------------------------------- I'm experiencing this issue as well, but my messages are not expiring. Steps to reproduce on AMQ 5.10.0, default configuration - just unzip and run: # Send a few messages to a queue # Browse it repeatedly # Observe that on some browse attempts hasMoreMessages() takes a very long time (tens of seconds) > QueueBrowser hangs until accidentally woken by expired messages background job > ------------------------------------------------------------------------------ > > Key: AMQ-5340 > URL: https://issues.apache.org/jira/browse/AMQ-5340 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.9.0, 5.10.0 > Reporter: Vermeulen > Priority: Critical > Labels: QueueBrowser > Attachments: AMQ5340BrowsingPerformanceBug.java > > > I would expect browsing a queue with only a few messages to not take a long time. Indeed it normally takes only a few ms. in my application. But sometimes the ActiveMQQueueBrowser hangs for up to 30 seconds at method before returning! > When the issue occurs, the loop in hasMoreElements() calls waitForMessage() multiple times which times out after 2s at semaphore.wait(2000) without receiving any message from the broker. I found that when the broker's background job that checks for expired messages runs, the browser happens to be woken even if there are no expired messages. So setting the expireMessagesPeriod to a low value (e.g. 200ms) is a good workaround for this issue, but this is quite brittle because it uses internal broker implementation that may not even be related to the issue! > To reproduce: > - (this is what I do in my application) create a queue, send a few message with an expiration time of 10 seconds and repeatedly browse it until it is empty. If I browse the queue after these 10 seconds have passed, the issue occurs! > - I can always reproduce the issue by running AMQ580BrowsingBug from the related bug report AMQ-4595: this browsing test seems to always hang. I slightly adjusted the test so you can easily change the expired messages period and see the runtime differ when changing this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)