Project

General

Profile

Actions

Bug #19415

closed

Incorrect circularity warning for concurrent requires

Added by fxn (Xavier Noria) almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:112220]

Description

This script performs 5 concurrent require calls to the same file:

threads = []

5.times do
  threads << Thread.new {
    p require 'bar'
  }
end

threads.each(&:join)

The file bar.rb is simply

sleep 0.1

Now, if you execute the main script with warnings enabled:

ruby -W2 -I. foo.rb

you'll see one true and four false as expected. But also four warnings:

circular require considered harmful - /Users/fxn/tmp/bar.rb

As you see, there isn't really a circular require going on, so the warning itself is incorrect. On the other hand, concurrent require calls for the same file is something routinely happening and supported.

I'd suggest that script should issue no warning.

Updated by byroot (Jean Boussier) almost 2 years ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED

I have a patch for this: https://github.com/ruby/ruby/pull/7252

That bug isn't very critical, but I think it wouldn't hurt to backport it, at least on recent versions.

Actions #2

Updated by byroot (Jean Boussier) almost 2 years ago

  • Status changed from Open to Closed

Updated by byroot (Jean Boussier) almost 2 years ago

  • Status changed from Closed to Open

Reopening as I reverted the patch because of some CI failures.

I'll improve the patch and merge again tomorrow.

Updated by byroot (Jean Boussier) almost 2 years ago

  • Status changed from Open to Closed
Actions #5

Updated by byroot (Jean Boussier) almost 2 years ago

  • Status changed from Closed to Open

Updated by byroot (Jean Boussier) almost 2 years ago

Fixed by 8ce2fb9bbbaea14737c84385b1573f743a30f773

Actions #7

Updated by byroot (Jean Boussier) almost 2 years ago

  • Status changed from Open to Closed

Updated by naruse (Yui NARUSE) over 1 year ago

  • Backport changed from 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: DONE

ruby_3_2 53f6173cfc085a7422b4a76c85e6c35969209327 merged revision(s) 8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1.

Updated by nagachika (Tomoyuki Chikanaga) over 1 year ago

  • Backport changed from 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: DONE to 2.7: WONTFIX, 3.0: WONTFIX, 3.1: DONE, 3.2: DONE

ruby_3_1 26b3f0b6a9489860e1d312369d784495b080daa3 merged revision(s) 8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0