Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97E8A1085E for ; Fri, 19 Dec 2014 18:42:16 +0000 (UTC) Received: (qmail 50340 invoked by uid 500); 19 Dec 2014 18:42:15 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 50283 invoked by uid 500); 19 Dec 2014 18:42:15 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 50272 invoked by uid 99); 19 Dec 2014 18:42:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Dec 2014 18:42:15 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mariano.l.gonzalez@gmail.com designates 209.85.216.42 as permitted sender) Received: from [209.85.216.42] (HELO mail-qa0-f42.google.com) (209.85.216.42) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Dec 2014 18:42:10 +0000 Received: by mail-qa0-f42.google.com with SMTP id n8so1019901qaq.1 for ; Fri, 19 Dec 2014 10:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=yJcrTNzItf2JDyhqOqEVdnCYwZKsQwhuJyw+MBfmSR8=; b=dRPfm3YP4Yumb4M5XZvKcMXYDQs1esfvw4vK+GoOpk/go/GKBfNOn06Zl1h8VucF+9 snvHiyigXY5/LeqNgapnEXbnsVJA28sAZs/3zAjJlRuKPZ0aX3rqgUHg6rbQXEoYYGWL ZOGtdrd5kYFkkw3jAji2JENvOJxrebZlBtHbtn+w3XXmgMWmMhMXLNKGcHnuIcUmejnx sk3hH5E29euB53/3zUzTJFjjCFlwmsMKZb3IVldmXRB2zSyj1oGV99ZGxwpvCWGD/V64 1xjn66IjmaFdQFAfgQFqILRe45/5acfugLgCRnQ7rxKbTZ1DSw3MoLvdeE/9dO0yvg61 nLrA== MIME-Version: 1.0 X-Received: by 10.140.96.195 with SMTP id k61mr15167245qge.104.1419014508120; Fri, 19 Dec 2014 10:41:48 -0800 (PST) Received: by 10.140.42.12 with HTTP; Fri, 19 Dec 2014 10:41:48 -0800 (PST) In-Reply-To: References: <7461130E-4BC7-470E-B78B-9248CA65D11E@gmail.com> Date: Fri, 19 Dec 2014 15:41:48 -0300 Message-ID: Subject: Re: Race condition stopping context From: Mariano Gonzalez To: Log4J Users List Content-Type: multipart/alternative; boundary=001a113ace06b011c3050a960f55 X-Virus-Checked: Checked by ClamAV on apache.org --001a113ace06b011c3050a960f55 Content-Type: text/plain; charset=UTF-8 Hello, I've been taking a look at LoggerContext#stop() and for what I see there's code to prevent disruptor to take new messages but there's nothing making sure that the ring buffer is empty before actually closing up. I did a simple test with an Appender wrapper like this: final class StopConditionSafeAppenderWrapper extends BaseAppenderWrapper { private final LoggerContext loggerContext; StopConditionSafeAppenderWrapper(Appender delegate, LoggerContext loggerContext) { super(delegate); this.loggerContext = loggerContext; } @Override public void append(LogEvent event) { if (!loggerContext.isStarted()) { return; } super.append(event); } } Using this appender wrapper I still get the same error, because at the time that append was closed the context was started but by the time disruptor processed it it was already stopped (this I could verify with a debugger). Should I open a bug? Any workaround you could suggest? Thanks! --001a113ace06b011c3050a960f55--