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 1BEC82027C for ; Mon, 17 Jul 2017 04:23:11 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 0880C120454; Mon, 17 Jul 2017 13:23:08 +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 66FE012040E for ; Mon, 17 Jul 2017 13:23:05 +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=5DmWcyApDImF2m1aw8RfGuQn6iY=; b=WNay/ehaflP0iy58yR VDO88Zy6LCgLZG3V4ZobAYkeJ1sMU8wWPfI79gvpG6HnXFZo+DeH1BhTtTr2MBug 66DRDRjHdSpzyKfaJd23arxMoahvrNVzh6ClGqPL+xk5Ctjs2B+ZIyF2KoCfDV91 UbpYwMWnqjnuw2f/qMLt+tj0A= Received: by filter0934p1mdw1.sendgrid.net with SMTP id filter0934p1mdw1-7066-596C3BA2-F 2017-07-17 04:22:58.573942762 +0000 UTC Received: from herokuapp.com (ec2-54-144-94-137.compute-1.amazonaws.com [54.144.94.137]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id X0KotqRbRamYHyOYvGBeyA for ; Mon, 17 Jul 2017 04:22:58.513 +0000 (UTC) Date: Mon, 17 Jul 2017 04:23:00 +0000 (UTC) From: sir.nickolas@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 57122 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13632 X-Redmine-Issue-Author: nvashchenko X-Redmine-Sender: nvashchenko 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7nglA9q8gfJFSUFzjqaaHagjhaaL3bPW81tf 4evwkmnycX2bSTFhksrNRSxL1fLg2S3ohtYz2usqbNkJ6OiEQeO053VmtjmUaTHo8pO7hlWaJlZMJi v7O+jTiFaRUi6Cqi0KdqJbiDjztkgpXKPefU6gfFRt4UxrjXdPAlEBMleQ== X-ML-Name: ruby-core X-Mail-Count: 82085 Subject: [ruby-core:82085] [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 nvashchenko (Nikolay Vashchenko). I created a gem with a temporary workaround for versions 2.2.7, 2.3.4 and 2.4.1 to help folks until versions with backports are released: https://rubygems.org/gems/stopgap_13632 ---------------------------------------- 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-65816 * 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/