ruby / uri

URI is a module providing classes to handle Uniform Resource Identifiers
https://ruby.github.io/uri/
Other
81 stars 43 forks source link

User assert_ractor for test case of Ractor #25

Closed hsbt closed 3 years ago

hsbt commented 3 years ago

The test-case of Ractor needs to separate the test process use by assert_ractor assertion. I will make it.

But I found a failure of test_ractor of uri library. @kvokka Can you look https://github.com/ruby/uri/runs/2911438018 ?

 #<Thread:0x00007fe5020e32d0 run> terminated with exception (report_on_exception is true):
  | /Users/runner/work/uri/uri/lib/uri/common.rb:75:in `scheme_list': can not access non-shareable objects in constant URI::SCHEME_LIST_MUTEX by non-main ractor. (Ractor::IsolationError)
hsbt commented 3 years ago

I'm not sure why they fails only macOS.

eregon commented 3 years ago

FWIW, it seems to work on Linux probably because bundler loads URI and so computes the URI::SCHEMES early, before the Ractor is created. Adding URI.refresh_scheme_list inside the Ractor.new {} fails reliably, and there is no way to share a Mutex between Ractors. https://github.com/ruby/uri/pull/26 avoids that issue.