Project

General

Profile

Actions

Bug #19415

closed

Incorrect circularity warning for concurrent requires

Added by fxn (Xavier Noria) over 1 year ago. Updated about 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0