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=-4.1 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 742B31F463 for ; Sun, 29 Sep 2019 17:31:41 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A09941209FF; Mon, 30 Sep 2019 02:31:32 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id E18041209FD for ; Mon, 30 Sep 2019 02:31:29 +0900 (JST) Received: by filter0136p3las1.sendgrid.net with SMTP id filter0136p3las1-32732-5D90EA73-6A 2019-09-29 17:31:31.946684361 +0000 UTC m=+513051.923796799 Received: from herokuapp.com (unknown [18.215.234.148]) by ismtpd0015p1iad1.sendgrid.net (SG) with ESMTP id U43aR0L4TdaCQlGdE8-dkg for ; Sun, 29 Sep 2019 17:31:31.727 +0000 (UTC) Date: Sun, 29 Sep 2019 17:31:31 +0000 (UTC) From: nobu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70702 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16186 X-Redmine-Issue-Author: byteit101 X-Redmine-Issue-Assignee: kosaki X-Redmine-Sender: nobu 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?q8Dly+pU2+3ektTtZVXgZtbJPXwqo7p86jCsvYTW4BxyqLv3HNkYxjMwjAISZY?= =?us-ascii?Q?x1w+Zd4wTMExt4ii7FuP8jKh8U8EqtufHhU6bVO?= =?us-ascii?Q?aXC2B65MlkVO9F+d4KmBbfjUaf5nS4fV0VrX40r?= =?us-ascii?Q?lHgAndHmXcgxMekZ8PztSXqKiu5UOlEmomicfL4?= =?us-ascii?Q?MLz6QrWiG8W3UFRzhgxFfe+82PBI8ioEvog=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95147 Subject: [ruby-core:95147] [Ruby master Bug#16186] Calling Net::HTTP from within an #inspect implementation hang when invoked from p 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 #16186 has been updated by nobu (Nobuyoshi Nakada). Assignee set to kosaki (Motohiro KOSAKI) Current implementation is since r38225 (fe6b2e20e9f17ed2c2900aa72994e075ffdc7124). I think this was discussed in the mailing list (probably ruby-dev), but I can't find it now. And I think which should be uninterruptible is only printing the argument and a newline. https://github.com/nobu/ruby/pull/new/bug/16186-allow-interrupts-during-inspect-in-p ---------------------------------------- Bug #16186: Calling Net::HTTP from within an #inspect implementation hang when invoked from p https://bugs.ruby-lang.org/issues/16186#change-81786 * Author: byteit101 (Patrick Plenefisch) * Status: Open * Priority: Normal * Assignee: kosaki (Motohiro KOSAKI) * Target version: * ruby -v: ruby 2.7.0dev (2019-09-27T18:22:21Z trunk d53cf85474) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Using this script: ``` ruby require 'net/http' class Victim def inspect puts "before" Net::HTTP.get('example.com', '/index.html') # this hangs. I haven't tried other network libraries puts "After" return "success" end end puts Victim.new.inspect # for some reason this doesn't hang puts "now we hang" p Victim.new # but this implicit invocation of inspect does hang. Independent of ordering, and works on JRuby puts "It worked!" ``` Expected: ``` $ rvm use jruby $ ruby bug.rb before After success now we hang before After success It worked! $ ``` Actual: ``` $ rvm use ruby-head $ ruby bug.rb before After success now we hang before ^C^C^Z [1] + 13423 suspended ruby bug.rb $ kill %1 $ (time passes) Traceback (most recent call last): 11: from bug.rb:12:in `
' 10: from bug.rb:12:in `p' 9: from bug.rb:5:in `inspect' 8: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/net/http.rb:458:in `get' 7: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/net/http.rb:476:in `get_response' 6: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/net/http.rb:919:in `start' 5: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/net/http.rb:930:in `do_start' 4: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/net/http.rb:945:in `connect' 3: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/timeout.rb:105:in `timeout' 2: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/timeout.rb:99:in `block in timeout' 1: from /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/timeout.rb:99:in `ensure in block in timeout' /home/byteit101/.rvm/rubies/ruby-head/lib/ruby/2.7.0/timeout.rb:99:in `join': Interrupt [1] + 13423 interrupt ruby bug.rb $ ``` The thing that is surprising to me is the explicit `print` + `inspect` works, whereas a straight `p` hangs. -- https://bugs.ruby-lang.org/