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 62EB61F453 for ; Tue, 30 Apr 2019 06:32:25 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4BDFB120A22; Tue, 30 Apr 2019 15:32:19 +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 3CAD81209A4 for ; Tue, 30 Apr 2019 15:32:16 +0900 (JST) Received: by filter0190p3mdw1.sendgrid.net with SMTP id filter0190p3mdw1-31422-5CC7EBF0-6 2019-04-30 06:32:16.127447577 +0000 UTC m=+381773.328154547 Received: from herokuapp.com (unknown [3.86.82.84]) by ismtpd0006p1iad2.sendgrid.net (SG) with ESMTP id Z5l7RwIDQputGsDzdK0_5g for ; Tue, 30 Apr 2019 06:32:16.151 +0000 (UTC) Date: Tue, 30 Apr 2019 06:32:16 +0000 (UTC) From: s.wanabe@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67970 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+dOtlSNbillIf=2F4zvrzkzGJ8GQl?= =?us-ascii?Q?JnObcuTn6ZD8jx3flzIju8CLi0ROOyP1H84uJfd?= =?us-ascii?Q?o9NPteYX6s6N1fl8PecGOCTk6q1qLtLKPN4fJPL?= =?us-ascii?Q?X++qcv6zN5wnATgnRFgtBAbKL59OHepXaYL+5l3?= =?us-ascii?Q?KUR7n7iQtqBLk9cKjixIx=2F2Z9iq83NwsBKA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92487 Subject: [ruby-core:92487] [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). How about this? ``` diff --git a/vm.c b/vm.c index 41064f07c3..be394b0dae 100644 --- a/vm.c +++ b/vm.c @@ -1895,7 +1895,7 @@ vm_exec(rb_execution_context_t *ec, int mjit_enable_p) } else { result = ec->errinfo; - rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW); + rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW | RAISED_NOMEMORY); while ((result = vm_exec_handle_exception(ec, state, result, &initial)) == Qundef) { /* caught a jump, exec the handler */ result = vm_exec_core(ec, initial); ``` ---------------------------------------- Bug #15779: After NoMemoryError, ruby freezes and takes 100% CPU https://bugs.ruby-lang.org/issues/15779#change-77832 * 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/