From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 01F4D1F4C0 for ; Fri, 25 Oct 2019 06:52:54 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 850D9120B9D; Fri, 25 Oct 2019 15:52:44 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id EB461120B98 for ; Fri, 25 Oct 2019 15:52:41 +0900 (JST) Received: by filter0082p3mdw1.sendgrid.net with SMTP id filter0082p3mdw1-4881-5DB29BBB-B 2019-10-25 06:52:43.180117191 +0000 UTC m=+289141.809847288 Received: from herokuapp.com (unknown [18.208.173.77]) by ismtpd0010p1iad1.sendgrid.net (SG) with ESMTP id RiG4_1b0QYGdSG7vsAeS2g for ; Fri, 25 Oct 2019 06:52:43.147 +0000 (UTC) Date: Fri, 25 Oct 2019 06:52:43 +0000 (UTC) From: cosmo0920.oucc@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71133 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16236 X-Redmine-Issue-Author: cosmo0920 X-Redmine-Sender: cosmo0920 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?gZOB1a5dMwJ2W7uoE2do10kQgu8FMhz2CP3skdNFGBgaAAnIbJvmZBSvh=2FEf5x?= =?us-ascii?Q?6aExVYPxXnb06fBgW+KdiDvLST9LsjHK9Qje5ik?= =?us-ascii?Q?EZrcRxYM3BNReFERDO3J2ja0MsPhmJlHZLNjvu0?= =?us-ascii?Q?z4zUS4VL3ogEdOUETYHy+J1BWkluILSDk3PM31h?= =?us-ascii?Q?=2FavtKVQcHxODGverpbWQsbxoQzTzLWPmanA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95541 Subject: [ruby-core:95541] [Ruby master Bug#16236] Cannot handle logrotate on Windows when one file is written from multi process/thread X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16236 has been updated by cosmo0920 (Hiroshi Hatake). Thanks for the information. This issue should be Fluentd logging mechanism issue not Ruby core logger library. Fluentd side logrotate issue is fixed. So, it can be closed. ---------------------------------------- Bug #16236: Cannot handle logrotate on Windows when one file is written from multi process/thread https://bugs.ruby-lang.org/issues/16236#change-82317 * Author: cosmo0920 (Hiroshi Hatake) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.6p354 (2019-04-01 revision 67394) [x64-mingw32] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ### TL;DR This issue occurred in Windows version of Fluentd. It uses ServerEngine and its logger functionality delegates into Ruby logger library. Fluentd's logrotate functionality is originated from Ruby logger library, Then, I found that this library does not seems to support logrotate under multi process/thread condition on Windows. ### Issue Detail When a log file which is written from the one process or thread, it works correctly: ``` require "logger" logger = Logger.new('test.log', 5, 30*1024) loop do logger.error "lost connection" logger.debug "got new connection" end ``` But logger writing file collision circumstances, it cannot handle logrotate correctly: ``` require "logger" logger = Logger.new('test.log', 5, 30*1024) myOtherLogger = Logger.new('test.log', 5, 30*1024) loop do logger.error "lost connection" logger.debug "got new connection" end ``` ``` ... log shifting failed. closed stream log writing failed. closed stream log shifting failed. closed stream log writing failed. closed stream log shifting failed. closed stream log writing failed. closed stream log shifting failed. closed stream log writing failed. closed stream log shifting failed. closed stream log writing failed. closed stream .... (after that many of these lines) ``` Fluentd launches spawn model (which has supervisor and several workers) on Windows. Currently, Fluentd implementation uses one logfile from supervisor and worker(s). So, it causes log shifting operation collision. ### Expected behavior Logrorating operation works correctly under multi process/threading circumstances on Windows like as Linux environment. -- https://bugs.ruby-lang.org/