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-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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 0998A1F9FD for ; Thu, 11 Mar 2021 00:01:19 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id B74611209DB; Thu, 11 Mar 2021 09:00:17 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 6B8991209CA for ; Thu, 11 Mar 2021 09:00:15 +0900 (JST) Received: by filterdrecv-p3mdw1-7745b6f999-s9n9c with SMTP id filterdrecv-p3mdw1-7745b6f999-s9n9c-18-60495DC5-9E 2021-03-11 00:01:09.968661896 +0000 UTC m=+1892689.190126335 Received: from herokuapp.com (unknown) by ismtpd0141p1mdw1.sendgrid.net (SG) with ESMTP id dbL9X8JGTba-YTtNJRRljw for ; Thu, 11 Mar 2021 00:01:09.880 +0000 (UTC) Date: Thu, 11 Mar 2021 00:01:09 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 78852 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17494 X-Redmine-Issue-Author: sue445 X-Redmine-Sender: jeremyevans0 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?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIuLm5Ke8XryPEC0uHxzcjY5k5hurtxoCtdavVU?= =?us-ascii?Q?jUuzipsVhXTHSJQ6llfDBsjgghpJgO8lE0Gq01A?= =?us-ascii?Q?3m+8gRaYVs3cO+=2FFX8z6BnbK=2F6HhL+Dkv=2FFWXpm?= =?us-ascii?Q?i57xcqqiYZpaPDKW354q6q4dkmffJAdrtsQHG4E?= =?us-ascii?Q?+rrTpPvXOxx3QfAyg=3D?= To: ruby-dev@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-dev X-Mail-Count: 51032 Subject: [ruby-dev:51032] [Ruby master Bug#17494] ruby is hanged when using activesupport + rspec + rspec-parameterized X-BeenThere: ruby-dev@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: "Ruby developers \(Japanese\)" List-Id: "Ruby developers \(Japanese\)" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-dev-bounces@ruby-lang.org Sender: "ruby-dev" Issue #17494 has been updated by jeremyevans0 (Jeremy Evans). One possible workaround for this is a checking for an immediate loop in `resolve_refined_method`: ```diff diff --git a/vm_method.c b/vm_method.c index 2573e708ba..ebfe686a27 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1245,7 +1245,7 @@ resolve_refined_method(VALUE refinements, const rb_method_entry_t *me, VALUE *de { while (me && me->def->type == VM_METHOD_TYPE_REFINED) { VALUE refinement; - const rb_method_entry_t *tmp_me; + const rb_method_entry_t *tmp_me, *prev_me = me; VALUE super; refinement = find_refinement(refinements, me->owner); @@ -1269,6 +1269,9 @@ resolve_refined_method(VALUE refinements, const rb_method_entry_t *me, VALUE *de } me = search_method_protect(super, me->called_id, defined_class_ptr); + if (me == prev_me) { + return 0; + } } return me; } ``` This fixes the case in the example, but maybe there are other more complex cases that it wouldn't catch. However, even if it won't catch all cases, until we have solved the underlying issue, this seems like a reasonable thing to add. I can submit a pull request for this if other committers are in favor. ---------------------------------------- Bug #17494: ruby is hanged when using activesupport + rspec + rspec-parameterized https://bugs.ruby-lang.org/issues/17494#change-90873 * Author: sue445 (Go Sueyoshi) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.0p0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- # Example code ## Gemfile ```ruby # frozen_string_literal: true source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } gem "activesupport", "6.1.0" gem "rspec", "3.10.0" gem "rspec-parameterized", "0.4.2" ``` ## spec file ``` ruby require "active_support/all" require "rspec-parameterized" describe "CLI" do subject do # Expected error, but actual hunged here cli.foo # <- hunged here end it { expect { subject }.to raise_error } end xdescribe "GitlabMrRelease::Project" do describe "#api_version" do using RSpec::Parameterized::TableSyntax where(:api_endpoint, :expected) do "http://example.com/api/v4/" | 4 end with_them do # it { should eq expected } end end end ``` all codes are here. https://github.com/sue445/ruby_3_0_0_bug_report_20201231 # Expected spec is successful (This is the behavior up to ruby 2.7.2) # Actual hunged at line 7 -- https://bugs.ruby-lang.org/