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=-3.1 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_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 6A3F41F461 for ; Thu, 16 May 2019 17:07:35 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D60BB120B54; Fri, 17 May 2019 02:07:29 +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 6E36C120A8A for ; Fri, 17 May 2019 02:07:27 +0900 (JST) Received: by filter0071p3las1.sendgrid.net with SMTP id filter0071p3las1-15989-5CDD98CC-11 2019-05-16 17:07:24.224122481 +0000 UTC m=+66532.442638141 Received: from herokuapp.com (unknown [3.90.204.230]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id zB-UjUyOTQSuhx3PEfXhPQ for ; Thu, 16 May 2019 17:07:24.213 +0000 (UTC) Date: Thu, 16 May 2019 17:07:24 +0000 (UTC) From: buzz.taiki@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68168 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15779 X-Redmine-Issue-Author: buzztaiki X-Redmine-Sender: buzztaiki 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?dpOKcU6=2F2RbGuJESXLpbn4HQdUt2DSk5xWhjgb5xtigsqF+HZ5z4hTKoahYqX8?= =?us-ascii?Q?sH2aPSFz=2F=2Fez1EFccu9DEDF2tvQXRQRljwMAX8l?= =?us-ascii?Q?CG=2FsRFouZ984KoQlCdAF6dJGktdIBgARtiyGqLN?= =?us-ascii?Q?bidpghycO4zh+rijvTsSgPdaBz2POAzwakDvNDU?= =?us-ascii?Q?+=2FnXmO8CWQKIrWLqVuPcBxcUWI0FItDdv+A=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92685 Subject: [ruby-core:92685] [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 buzztaiki (Taiki Sugawara). Thank you for your reply! In my environment, this patch with ruby 2.6.3 has been fixed this issue (ruby was not frozen)!! ``` ~/opt/ruby/bug15779_v2_6_3_fix/bin/ruby ~/tmp/a.rb #, @meta={"server"=>"Cowboy", "strict-transport-security"=>"max-age=31536000", "content-type"=>"text/html", "etag"=>"W/\"91e88008983 2f50e7e7bf1371600cc60\"", "x-frame-options"=>"SAMEORIGIN", "via"=>"1.1 vegur, 1.1 varnish", "content-length"=>"424", "accept-ranges"=>"bytes", "date"=>"Thu, 16 May 2019 17:04:03 GMT", "age"=>"1082", "connection"=>"keep-alive", "x-served-by"=>"cache-hnd18751-HND", "x-cache"=>"HIT", "x-cache-hits"=>"1", "x-timer"=>"S1558026243.322961,VS0,VE0", "vary"=>"Accept-Encoding"}, @metas={"server"=>["Cowboy"], "strict-transport-security"=>["max-age=31536000"], "content-type"=>["text/html"], "etag"=>["W/\"91e880089832f50e7e7bf1371600cc60\""], "x-frame-options"=>["SAMEORIGIN"], "via"=>["1.1 vegur", "1.1 varnish"], "content-length"=>["424"], "accept-ranges"=>["bytes"], "date"=>["Thu, 16 May 2019 17:04:03 GMT"], "age"=>["1082"], "connection"=>["keep-alive"], "x-served-by"=>["cache-hnd18751-HND"], "x-cache"=>["HIT"], "x-cache-hits"=>["1"], "x-timer"=>["S1558026243.322961,VS0,VE0"], "vary"=>["Accept-Encoding"]}, @status=["200", "OK"]> Traceback (most recent call last): /home/taiki/tmp/a.rb: failed to allocate memory (NoMemoryError) ``` ``` cat ~/tmp/a.rb require 'open-uri' begin "a" * 10000000000 ensure p open('https://www.ruby-lang.org/') end ``` ---------------------------------------- Bug #15779: After NoMemoryError, ruby freezes and takes 100% CPU https://bugs.ruby-lang.org/issues/15779#change-78045 * 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/