From fa49651e05a06512e18ccb2f54a7198c9ff579de Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Mon, 6 Feb 2023 12:30:50 +0100 Subject: Only emit circular dependency warning for owned thread shields [Bug #19415] If multiple threads attemps to load the same file concurrently it's not a circular dependency issue. So we check that the existing ThreadShield is owner by the current fiber before warning about circular dependencies. --- spec/ruby/core/kernel/shared/require.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/ruby/core/kernel/shared/require.rb') diff --git a/spec/ruby/core/kernel/shared/require.rb b/spec/ruby/core/kernel/shared/require.rb index 666ca15e11..c629b44389 100644 --- a/spec/ruby/core/kernel/shared/require.rb +++ b/spec/ruby/core/kernel/shared/require.rb @@ -237,6 +237,16 @@ describe :kernel_require, shared: true do }.should complain(/circular require considered harmful/, verbose: true) ScratchPad.recorded.should == [:loaded] end + + ruby_bug "#17340", ''...'3.3' do + it "loads a file concurrently" do + path = File.expand_path "concurrent_require_fixture.rb", CODE_LOADING_DIR + ScratchPad.record(@object) + -> { + @object.require(path) + }.should_not complain(/circular require considered harmful/, verbose: true) + end + end end describe "(non-extensioned path)" do -- cgit v1.2.3