From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,SPF_PASS, T_DKIM_INVALID shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 0266B20357 for ; Sat, 8 Jul 2017 02:21:49 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 2B5AD120882; Sat, 8 Jul 2017 11:21:48 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id C71D312087D for ; Sat, 8 Jul 2017 11:21:45 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=6xabGt0rAkMXbrQoAe5wObMpG0g=; b=KuD/W7qpxhGdTk/NO/ tYdhwbA5Bq9Ng65Cn5SIXx6Y5Xz7R/5UWFA5DlPNd877AkMDMvYCFh9k6PD8Otfy BVrTTwankvEoHCWyyVj3j+UxJTUIdOsbnQXg3mJ/9J9QR8g4KuYRPEELijU4Jt2Z xgWK4+SvVBoM2e4/UuNjOJ4WY= Received: by filter0532p1mdw1.sendgrid.net with SMTP id filter0532p1mdw1-25430-596041B5-10 2017-07-08 02:21:41.160040423 +0000 UTC Received: from herokuapp.com (ec2-54-156-91-169.compute-1.amazonaws.com [54.156.91.169]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id 1ec_g8pVSrqZtd-EcZePVw for ; Sat, 08 Jul 2017 02:21:41.088 +0000 (UTC) Date: Sat, 08 Jul 2017 02:21:41 +0000 (UTC) From: nagachika00@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 56997 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13632 X-Redmine-Issue-Author: nvashchenko X-Redmine-Sender: nagachika 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4cy5OsN+07cIm/T4WUXgkvNS23UCa+jEsfex A9wEFb/0R0V9tRPlR11/FApd09jci/xRwJj8iWBCuVLyrKwuGcWRfOmdAiB9oAupLkmzDkBZkUTjQv ejQxl8wKpNjK/3uEJPlhaypydgs/Ws3Cji4cQXCdDiIv0cBxJgjekAmSww== X-ML-Name: ruby-core X-Mail-Count: 81966 Subject: [ruby-core:81966] [Ruby trunk Bug#13632] Not processable interrupt queue for a thread after it's notified that FD is closed in some other 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 #13632 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.2: UNKNOWN, 2.3: DONE, 2.4: REQUIRED to 2.2: UNKNOWN, 2.3: DONE, 2.4: DONE ruby_2_4 r59286 merged revision(s) 58284,58812,59028. ---------------------------------------- Bug #13632: Not processable interrupt queue for a thread after it's notified that FD is closed in some other thread. https://bugs.ruby-lang.org/issues/13632#change-65689 * Author: nvashchenko (Nikolay Vashchenko) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: 2.2.x, 2.3.x, 2.4.x, 2.5.x * Backport: 2.2: UNKNOWN, 2.3: DONE, 2.4: DONE ---------------------------------------- In the bugfix for https://bugs.ruby-lang.org/issues/13076 has been introduced another bug, caused by a busy waiting in rb_notify_fd_close method, while the FD is being released. During this waiting, it pumps huge amounts of the ruby_error_stream_closed errors into thread's interrupt queue, which almost all stay there unprocessed. It can be up for several hundred of exceptions in the queue, depending on circumstances. ``` a = [] t = [] 10.times do r,w = IO.pipe a << [r,w] t << Thread.new do while r.gets end rescue IOError # Interrupt queue is full and all IO is broken Thread.current.pending_interrupt? # Expected to be false, because it's already rescued IO.sysopen ("/dev/tty") # Expected not to throw an error. On each such call, it dequeues the next item from interrupt queue until there's none end end a.each do |r,w| w.puts "test" w.close r.close end t.each do |th| th.join end ``` Output: ``` text Traceback (most recent call last): 1: from test2.rb:9:in `block (2 levels) in
' test2.rb:9:in `sysopen': stream closed in another thread (IOError) ``` -- https://bugs.ruby-lang.org/