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 25D9A1F466 for ; Tue, 14 Jan 2020 21:33:52 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 958AC120A8A; Wed, 15 Jan 2020 06:33:27 +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 2234E120A85 for ; Wed, 15 Jan 2020 06:33:23 +0900 (JST) Received: by filterdrecv-p3mdw1-56c97568b5-cmkgv with SMTP id filterdrecv-p3mdw1-56c97568b5-cmkgv-18-5E1E33AA-36 2020-01-14 21:33:30.735869876 +0000 UTC m=+2494224.330616636 Received: from herokuapp.com (unknown [54.227.193.20]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id Rq-t3XwsRG2vEZA7ixZe0w for ; Tue, 14 Jan 2020 21:33:30.661 +0000 (UTC) Date: Tue, 14 Jan 2020 21:33:30 +0000 (UTC) From: jimmaino@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72521 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16509 X-Redmine-Issue-Author: jmaino X-Redmine-Sender: jmaino 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?xln11sPY7If=2Fb0aegd=2FZ9o3Pl+fRT7TNRJiJszteH9inLhVoN90+wAGz8jMPBz?= =?us-ascii?Q?bg=2FGVaerbwI5yLaIiWG0qC7sx38msOw4eNe19Th?= =?us-ascii?Q?+kYGw8XZn56lKI0u7dDQebKfGJwxSsn4STJoSA0?= =?us-ascii?Q?mmnXyVNQiKmWZbuJKcb2O3MIos=2F+7epbO+qy2jS?= =?us-ascii?Q?zFYiTj85yk9LyjG4ndryMMT=2F0DQIAeYbLTkKJ6d?= =?us-ascii?Q?pFtrb6jZ1CR6YIQfU=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96858 Subject: [ruby-core:96858] [Ruby master Bug#16509] puts from EM within a thread seem to be missing linefeed when run in ruby 2.7.0 console 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 #16509 has been reported by jmaino (Jim Maino). ---------------------------------------- Bug #16509: puts from EM within a thread seem to be missing linefeed when run in ruby 2.7.0 console https://bugs.ruby-lang.org/issues/16509 * Author: jmaino (Jim Maino) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.7.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- This is strange, and I'm hoping I explain it sufficiently - but I've upgraded to ruby 2.7.0 and I'm seeing missing linefeeds in puts outputs from EM that's within a thread. I did not see this problem when running in ruby 2.6.5's console output - it seems to be related to my move to 2.7.0. I've simplified this to reproduce this as folllows. If I run the following EM without being inside of a thread, then I get an OK output - example: irb(main):042:1* EventMachine.run do irb(main):043:1* EM.add_periodic_timer(1) { puts "Tick ..." } irb(main):044:1* irb(main):045:2* EM.add_timer(3) do irb(main):046:2* puts "I waited 3 seconds" irb(main):047:2* EM.stop_event_loop irb(main):048:1* end irb(main):049:0> end Tick ... Tick ... I waited 3 seconds => nil Note all of the strings that are output from the puts commands within the EM loop are fully left-justified in the output. But if I wrap this in a thread, the output lines appear to be missing the linefeed, but do have the CR - such that the successive puts strings are not left justified as they sequence, and build from the X-offset that ended the previous puts string output. irb(main):001:1* Thread.new do irb(main):002:2* EventMachine.run do irb(main):003:2* EM.add_periodic_timer(1) { puts "Tick ..." } irb(main):004:2* irb(main):005:3* EM.add_timer(3) do irb(main):006:3* puts "I waited 3 seconds" irb(main):007:3* EM.stop_event_loop irb(main):008:2* end irb(main):009:1* end irb(main):010:0> end => # irb(main):011:0> Tick ... _________________________Tick ... _______________________________ I waited 3 seconds Is there something that's known to have changed that is causing this? Can others reproduce this as well? I can't tell is this is EM's or ruby's - so any help would really be appreciated. However, the folks over at eventmachine think this belongs to ruby and not themselves. I only see this from puts statements within the EM loop within a Thread. If the wrapping Thread is not there, there's no issue. If there's just a sequence of puts in a Thread and no EM loop, there's no issue. It seems as if there's something about the combo of a Thread wrapping an EM loop that's making the underlying puts misbehave. Thanks, -Jim -- https://bugs.ruby-lang.org/