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 C5D79200C1C for ; Wed, 1 Feb 2017 05:21:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C4880160B5F; Wed, 1 Feb 2017 04:21:01 +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 E65F4160B52 for ; Wed, 1 Feb 2017 05:21:00 +0100 (CET) Received: (qmail 89742 invoked by uid 500); 1 Feb 2017 04:21:00 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 89731 invoked by uid 99); 1 Feb 2017 04:20:59 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2017 04:20:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 654EBC0096 for ; Wed, 1 Feb 2017 04:20:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.998 X-Spam-Level: X-Spam-Status: No, score=-1.998 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ee-Q5oujk-7Y for ; Wed, 1 Feb 2017 04:20:58 +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 CBF505F239 for ; Wed, 1 Feb 2017 04:20:57 +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 CC2EEE026F for ; Wed, 1 Feb 2017 04:20:51 +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 897072528B for ; Wed, 1 Feb 2017 04:20:51 +0000 (UTC) Date: Wed, 1 Feb 2017 04:20:51 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (IO-528) Tailer.run race condition runaway logging MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 01 Feb 2017 04:21:02 -0000 [ https://issues.apache.org/jira/browse/IO-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15848000#comment-15848000 ] ASF GitHub Bot commented on IO-528: ----------------------------------- GitHub user davidmoten opened a pull request: https://github.com/apache/commons-io/pull/29 [IO-528] fix Tailer.run race condition runaway logging `Tailer.run` has a race condition that can have serious effects. The `run()` method has two while loops. The first waits till the file exists and the second loop reads lines from the file doing some file rotation checking on the way. If the file is deleted while the second loop is in progress then the loop goes crazy logging warnings that look like this: ` Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated INFO: file rotated Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound WARNING: file not found Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated INFO: file rotated Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound WARNING: file not found Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated INFO: file rotated Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound WARNING: file not found Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated INFO: file rotated Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound WARNING: file not found ` In our case this had serious effects. The file being tailed was deleted by another process and all available disk space was rapidly used up by the logging. This crashed a system. The fix is to put a sleep after the call to `fileNotFound()`. I haven't made a unit test because reliably triggering this problem would involve a major refactor of the `run` method to make it testable. You can merge this pull request into a Git repository by running: $ git pull https://github.com/davidmoten/commons-io fix-tailer-race-condition Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-io/pull/29.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #29 ---- commit b6c13341564475f4b804ec8e46f665211236b7f7 Author: Dave Moten Date: 2017-02-01T03:54:00Z fix Tailer.run race condition runaway logging ---- > Tailer.run race condition runaway logging > ----------------------------------------- > > Key: IO-528 > URL: https://issues.apache.org/jira/browse/IO-528 > Project: Commons IO > Issue Type: Bug > Components: Utilities > Affects Versions: 2.5 > Reporter: Dave Moten > > `Tailer.run` has a race condition that can have serious effects. > The `run()` method has two while loops. The first waits till the file exists and the second loop reads lines from the file doing some file rotation checking on the way. If the file is deleted while the second loop is in progress then the loop goes crazy logging warnings that look like this: > ` > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated > INFO: file rotated > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound > WARNING: file not found > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated > INFO: file rotated > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound > WARNING: file not found > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated > INFO: file rotated > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound > WARNING: file not found > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileRotated > INFO: file rotated > Dec 06, 2016 1:02:18 AM com.github.davidmoten.logan.LogFile$1 fileNotFound > WARNING: file not found > ` > In our case this had serious effects. The file being tailed was deleted by another process and all available disk space was rapidly used up by the logging. This crashed a system. > The fix is to put a sleep after the call to `fileNotFound()`. > This problem was raised in IO-398 three years ago but no change was made to the code base. > PR submitted via github repo. -- This message was sent by Atlassian JIRA (v6.3.15#6346)