From: merch-redmine@... Date: 2021-03-11T00:01:09+00:00 Subject: [ruby-dev:51032] [Ruby master Bug#17494] ruby is hanged when using activesupport + rspec + rspec-parameterized 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/