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 CBEE4200C5A for ; Tue, 18 Apr 2017 19:06:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CA915160BB4; Tue, 18 Apr 2017 17:06:33 +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 1DE8B160BA1 for ; Tue, 18 Apr 2017 19:06:32 +0200 (CEST) Received: (qmail 72156 invoked by uid 500); 18 Apr 2017 17:06:32 -0000 Mailing-List: contact commits-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 commits@activemq.apache.org Received: (qmail 72120 invoked by uid 99); 18 Apr 2017 17:06:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Apr 2017 17:06:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 423BDDFDAC; Tue, 18 Apr 2017 17:06:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbertram@apache.org To: commits@activemq.apache.org Date: Tue, 18 Apr 2017 17:06:32 -0000 Message-Id: In-Reply-To: <51afeb5b2b5948468b6c67a90cd7cfe0@git.apache.org> References: <51afeb5b2b5948468b6c67a90cd7cfe0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/6] activemq-artemis git commit: ARTEMIS-1117 Improving IO Failure resilience Part I archived-at: Tue, 18 Apr 2017 17:06:34 -0000 ARTEMIS-1117 Improving IO Failure resilience Part I Me (Clebert) and Francesco worked independently here. I am keeping Francesco's changes on a separate commit https://issues.apache.org/jira/browse/ARTEMIS-1117 Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/23ba3e27 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/23ba3e27 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/23ba3e27 Branch: refs/heads/master Commit: 23ba3e27d90b85240f7181b5d792848727fdf172 Parents: 7d5511c Author: Francesco Nigro Authored: Thu Apr 13 17:48:00 2017 +0200 Committer: Clebert Suconic Committed: Tue Apr 18 11:34:09 2017 -0400 ---------------------------------------------------------------------- .../artemis/core/io/aio/AIOSequentialFile.java | 38 +++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/23ba3e27/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java ---------------------------------------------------------------------- diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java index f641aec..9d3a824 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java @@ -18,6 +18,8 @@ package org.apache.activemq.artemis.core.io.aio; import java.io.File; import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; import java.nio.ByteBuffer; import java.util.PriorityQueue; import java.util.concurrent.Executor; @@ -100,16 +102,34 @@ public class AIOSequentialFile extends AbstractSequentialFile { super.close(); - if (!pendingCallbacks.await(10, TimeUnit.SECONDS)) { - factory.onIOError(new IOException("Timeout on close"), "Timeout on close", this); - } - - opened = false; - - timedBuffer = null; + final String fileName = this.getFileName(); + try { + int waitCount = 0; + while (!pendingCallbacks.await(10, TimeUnit.SECONDS)) { + waitCount++; + if (waitCount == 1) { + final ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true); + for (ThreadInfo threadInfo : threads) { + ActiveMQJournalLogger.LOGGER.warn(threadInfo.toString()); + } + factory.onIOError(new IOException("Timeout on close"), "Timeout on close", this); + } + ActiveMQJournalLogger.LOGGER.warn("waiting pending callbacks on " + fileName + " from " + (waitCount * 10) + " seconds!"); + } + } catch (InterruptedException e) { + ActiveMQJournalLogger.LOGGER.warn("interrupted while waiting pending callbacks on " + fileName, e); + throw e; + } finally { + + opened = false; + + timedBuffer = null; + + aioFile.close(); + + aioFile = null; - aioFile.close(); - aioFile = null; + } } @Override