Project

General

Profile

Actions

Bug #12999

closed

there still exist race conditions in require

Added by shugo (Shugo Maeda) over 7 years ago. Updated over 7 years ago.

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

Description

TestRequire#test_require_with_loaded_features_pop fails by increasing the number of threads,
so it seems that there still exist race conditions in require.

lexington:ruby$ cat t/require_test.rb
require "tempfile"

Tempfile.create(%w'bug-7530- .rb') {|script|
  script.close
  PATH = script.path
  THREADS = 10
  ITERATIONS_PER_THREAD = 1000

  THREADS.times.map {
    Thread.new do
      ITERATIONS_PER_THREAD.times do
        require PATH
        $".delete_if {|p| Regexp.new(PATH) =~ p}
      end
    end
  }.each(&:join)
  p :ok
}
lexington:ruby$ ./ruby t/require_test.rb
/home/shugo/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': destroyed thread shield - 0x00557a99ff5a78 (ThreadError)
	from /home/shugo/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from t/require_test.rb:12:in `block (4 levels) in <main>'
	from t/require_test.rb:11:in `times'
	from t/require_test.rb:11:in `block (3 levels) in <main>'
lexington:ruby$ ./ruby t/require_test.rb
/home/shugo/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': Attempt to unlock a mutex which is locked by another thread (ThreadError)
	from /home/shugo/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from t/require_test.rb:12:in `block (4 levels) in <main>'
	from t/require_test.rb:11:in `times'
	from t/require_test.rb:11:in `block (3 levels) in <main>'

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #7530: Concurrent loads fail with mutex errorsClosedGlass_saga (Masaki Matsushita)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0