Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 69AC3200CB1 for ; Sat, 24 Jun 2017 14:50:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 682F1160BDA; Sat, 24 Jun 2017 12:50:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AEF49160BE6 for ; Sat, 24 Jun 2017 14:50:11 +0200 (CEST) Received: (qmail 87893 invoked by uid 500); 24 Jun 2017 12:50:10 -0000 Mailing-List: contact issues-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 issues@activemq.apache.org Received: (qmail 87884 invoked by uid 99); 24 Jun 2017 12:50:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Jun 2017 12:50:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9044BC66E0 for ; Sat, 24 Jun 2017 12:50:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id r4IVtCLEaP4g for ; Sat, 24 Jun 2017 12:50:08 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id EA6285FD81 for ; Sat, 24 Jun 2017 12:50:07 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 59CC4E0DE3 for ; Sat, 24 Jun 2017 12:50:06 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5C9FA240C4 for ; Sat, 24 Jun 2017 12:50:02 +0000 (UTC) Date: Sat, 24 Jun 2017 12:50:02 +0000 (UTC) From: "Christopher L. Shannon (JIRA)" To: issues@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AMQ-5659) Add safety measure against infinite loop when store exception prevents message removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 24 Jun 2017 12:50:12 -0000 [ https://issues.apache.org/jira/browse/AMQ-5659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Christopher L. Shannon updated AMQ-5659: ---------------------------------------- Fix Version/s: (was: 5.15.0) > Add safety measure against infinite loop when store exception prevents message removal > -------------------------------------------------------------------------------------- > > Key: AMQ-5659 > URL: https://issues.apache.org/jira/browse/AMQ-5659 > Project: ActiveMQ > Issue Type: Improvement > Components: Broker > Affects Versions: 5.7.0 > Environment: ServiceMix 4.5.3 > Reporter: metatech > Assignee: Claus Ibsen > Attachments: purge_queue_abort_loop_v3.patch > > > When the broker is configured with a database store, the "purge" operation enters an infinite loop when the message removal operation fails, for instance when the broker datasource is being restarted (see example stack trace below). > Here is a patch which adds a safety measure, in case the "dequeue" count of the queue does not increase between 2 messages removal operations. The check is not garanteed to detect the problem on the next iteration, because a business consumer might also be dequeuing messages from the queue. But the "purge" is probably much faster than the business consumer, so if it fails to remove 2 messages in a row, it is enough to detect the problem and abort the infinite loop. > {code} > 2015-03-05 15:38:30,353 | WARN | 14571659-2202099 | | JDBCPersistenceAdapter | Could not get JDBC connection: Data source is closed > java.sql.SQLException: Data source is closed > at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1362) > at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) > at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:58) > at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.getStoreSequenceId(DefaultJDBCAdapter.java:285) > at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getStoreSequenceIdForMessageId(JDBCPersistenceAdapter.java:787) > at org.apache.activemq.store.jdbc.JDBCMessageStore.removeMessage(JDBCMessageStore.java:194) > at org.apache.activemq.store.memory.MemoryTransactionStore.removeMessage(MemoryTransactionStore.java:358) > at org.apache.activemq.store.memory.MemoryTransactionStore$1.removeAsyncMessage(MemoryTransactionStore.java:166) > at org.apache.activemq.broker.region.Queue.acknowledge(Queue.java:846) > at org.apache.activemq.broker.region.Queue.removeMessage(Queue.java:1602) > at org.apache.activemq.broker.region.Queue.removeMessage(Queue.java:1594) > at org.apache.activemq.broker.region.Queue.removeMessage(Queue.java:1579) > at org.apache.activemq.broker.region.Queue.purge(Queue.java:1158) > at org.apache.activemq.broker.jmx.QueueView.purge(QueueView.java:54) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)