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.9 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_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 A05361F453 for ; Tue, 30 Apr 2019 03:52:17 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1C02D120A0B; Tue, 30 Apr 2019 12:52:12 +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 9DD6F120A28 for ; Tue, 30 Apr 2019 12:52:09 +0900 (JST) Received: by filter0074p3iad2.sendgrid.net with SMTP id filter0074p3iad2-24989-5CC7C669-1F 2019-04-30 03:52:09.883057737 +0000 UTC m=+371492.185777697 Received: from herokuapp.com (unknown [3.86.82.84]) by ismtpd0020p1iad2.sendgrid.net (SG) with ESMTP id f5pdQo38RsCNHaOm8m3h_w for ; Tue, 30 Apr 2019 03:52:10.057 +0000 (UTC) Date: Tue, 30 Apr 2019 03:52:10 +0000 (UTC) From: s.wanabe@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67969 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15779 X-Redmine-Issue-Author: buzztaiki X-Redmine-Sender: wanabe 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?FsuGSN1PD4adq4aDFRSSBF8ffe=2F4plpeX9T+dOtlSNYIfXYqCA0rLseJKRLgcW?= =?us-ascii?Q?3C+FLK1Zh=2Fb3MOpcjHmg7+h=2FPQ3GX2V4hkr=2FS0f?= =?us-ascii?Q?+q1QkZ=2F8lcK=2Fz8GPb=2FSr8n2hX2ACa+eH1RS9mPP?= =?us-ascii?Q?+Zvpi5Y3pJPKbEqA1FSCBKDktY0qNyPAgGJx5XW?= =?us-ascii?Q?91IkJQhbf88ryveYiH8=2F=2FMxBYZSvOCIn2IA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92486 Subject: [ruby-core:92486] [Ruby trunk Bug#15779] After NoMemoryError, ruby freezes and takes 100% CPU 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 #15779 has been updated by wanabe (_ wanabe). I think it is from r58380. before r58380, `rb_memerror` calls `rb_longjmp` via `rb_exc_raise` and clear raised_flag. But now `rb_memerror` keeps raised_flag and just calls `EC_JUMP_TAG`. `rb_threadptr_execute_interrupts` should raise `Interrupt` exception on hitting ctrl-c, but just return immediately because `th->raised_flag` is truthy. I've confirmed above behavior with the script to use `miniruby`. ``` begin "a" * 10000000000 ensure Thread.new(Thread.current) do |t| Thread.pass t.raise Interrupt sleep 0.01 STDERR.puts "shutting down..." Process.kill :KILL, $$ end sleep end ``` ---------------------------------------- Bug #15779: After NoMemoryError, ruby freezes and takes 100% CPU https://bugs.ruby-lang.org/issues/15779#change-77831 * Author: buzztaiki (Taiki Sugawara) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Run following reproduce code, ruby freezes and takes 100% CPU. ``` require 'open-uri' begin "a" * 10000000000 ensure p open('https://www.ruby-lang.org/') end ``` But interestingly, the following code does not reproduce this issue. ``` require 'open-uri' begin begin "a" * 10000000000 rescue NoMemoryError raise end ensure p open('https://www.ruby-lang.org/') end ``` It was also reproduced when put `sleep 100` in ensure clause, run it and hit Ctrl-C. But `puts 'XXX'` does not reproduce it. ---Files-------------------------------- strace.txt (377 KB) -- https://bugs.ruby-lang.org/