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=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham 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 34E5D1F8C6 for ; Wed, 23 Jun 2021 10:33:05 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A718E120AEE; Wed, 23 Jun 2021 19:31:52 +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 DD2CD120AD2 for ; Wed, 23 Jun 2021 19:31:50 +0900 (JST) Received: by filterdrecv-c8c5888c4-g5bqv with SMTP id filterdrecv-c8c5888c4-g5bqv-1-60D30DDB-45 2021-06-23 10:32:59.799887727 +0000 UTC m=+372307.305041071 Received: from herokuapp.com (unknown) by geopod-ismtpd-3-2 (SG) with ESMTP id -SP5PhZjThmEK4pttlz5kQ for ; Wed, 23 Jun 2021 10:32:59.579 +0000 (UTC) Date: Wed, 23 Jun 2021 10:32:59 +0000 (UTC) From: samuel@oriontransfer.net Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17801 X-Redmine-Issue-Author: pebauer X-Redmine-Issue-Assignee: ioquatix X-Redmine-Sender: ioquatix 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-Redmine-MailingListIntegration-Message-Ids: 80502 X-SG-EID: =?us-ascii?Q?cjxb6GWHefMLoR50bkJBcGo6DRiDl=2FNYcMZdY+Wj30Ra1QnRWXcU4kDE2BKAKl?= =?us-ascii?Q?5LoHRaTBbUXLX=2F4Iive7Qk2HG0ZFzmQxBvS6ys8?= =?us-ascii?Q?NZRrAi2kisOO42mBO1+DUgAvtjZ=2FSD456Ms2W0l?= =?us-ascii?Q?F7=2Fw7nUyew0HVnaEisSv5y5KJDs9ruBn2GgxXAF?= =?us-ascii?Q?JIOeKcASggHWmTjxLtS4PXvc+JFxpk3GtXljSmP?= =?us-ascii?Q?NDcL4qlZ8ilXRcvJw=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 104387 Subject: [ruby-core:104387] [Ruby master Bug#17801] repeated read from PTY blocks all Fibers 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 #17801 has been updated by ioquatix (Samuel Williams). This works for me if I set: ``` master.nonblock = true ``` Can you try it and report back? We could consider making this the default. ---------------------------------------- Bug #17801: repeated read from PTY blocks all Fibers https://bugs.ruby-lang.org/issues/17801#change-92622 * Author: pebauer (peter bauer) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) * ruby -v: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- Ruby version: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux] used Scheduler: https://github.com/ruby/ruby/blob/master/test/fiber/scheduler.rb Example Code which should work: ``` require 'pty' require "./scheduler.rb" line_event = TracePoint.new(:line) do |t| p [t.lineno, t.method_id, t.path] end Fiber.set_scheduler(Scheduler.new) master, slave = PTY.open read, write = IO.pipe pid = spawn("bash", :in=>read, :out=>slave) read.close # we dont need the read slave.close # or the slave line_event.enable do Fiber.schedule do loop do puts "date" write.puts "date" sleep 1 end end Fiber.schedule do loop do puts master.gets.chomp puts master.gets.chomp # this line blocks all fibers, why ? puts "test" sleep 1 end end #write.close end ``` -- https://bugs.ruby-lang.org/