From: "fxn (Xavier Noria) via ruby-core" Date: 2023-02-05T08:00:50+00:00 Subject: [ruby-core:112220] [Ruby master Bug#19415] Incorrect circularity warning for concurrent requires Issue #19415 has been reported by fxn (Xavier Noria). ---------------------------------------- Bug #19415: Incorrect circularity warning for concurrent requires https://bugs.ruby-lang.org/issues/19415 * Author: fxn (Xavier Noria) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- This script performs 5 concurrent `require` calls to the same file: ```ruby threads = [] 5.times do threads << Thread.new { p require 'bar' } end threads.each(&:join) ``` The file `bar.rb` is simply ```ruby 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. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/