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 88A0B1F4C0 for ; Fri, 25 Oct 2019 06:53:51 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id BACB2120BA1; Fri, 25 Oct 2019 15:53:42 +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 745D4120B9F for ; Fri, 25 Oct 2019 15:53:40 +0900 (JST) Received: by filter0089p3las1.sendgrid.net with SMTP id filter0089p3las1-18118-5DB29BF3-38 2019-10-25 06:53:39.563413582 +0000 UTC m=+290721.867894643 Received: from herokuapp.com (unknown [18.208.173.77]) by ismtpd0073p1mdw1.sendgrid.net (SG) with ESMTP id vj1vB_cHS6GKOYeGXafsDQ for ; Fri, 25 Oct 2019 06:53:39.440 +0000 (UTC) Date: Fri, 25 Oct 2019 06:53:39 +0000 (UTC) From: cosmo0920.oucc@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71134 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?gZOB1a5dMwJ2W7uoE2do10kQgu8FMhz2CP3skdNFGBjnyYs8yN1peNxSq+PwJA?= =?us-ascii?Q?mr1fC44mKYZvELEKUiqEBv054KmJS+1PIU7VC2z?= =?us-ascii?Q?cIItBK0gXZdXgBfklxTmHb3rfm7vmYz+IsKrRdU?= =?us-ascii?Q?yyeXF6Ru3iy0iKR4jlHY0hDE2sZWW82Qld6xkRx?= =?us-ascii?Q?8dn01UzXvK3DzqxhnNRmR00hnEcbHx7jLbQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95542 Subject: [ruby-core:95542] [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). Fluentd side patch: https://github.com/fluent/fluentd/pull/2663 Fluentd side issue: https://github.com/fluent/fluentd/issues/2446 ---------------------------------------- Bug #16236: Cannot handle logrotate on Windows when one file is written from multi process/thread https://bugs.ruby-lang.org/issues/16236#change-82318 * 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/