-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove thread-unsafe runtime requires #43
base: master
Are you sure you want to change the base?
Commits on Jun 28, 2023
-
Replace thread-unsafe runtime requires with vanilla autoload
Dynamically requiring implementations at runtime in this way is not safe in a multithreaded program, even in MRI with the GIL. We can simplify this by just using autoload and turning the @@class_map into a simple case statement. Fixes sparklemotion#27
Configuration menu - View commit details
-
Copy full SHA for bf6391b - Browse repository at this point
Copy the full SHA bf6391bView commit details -
Further remove autoloading, the issue still repros on jruby and truffle
Repro: require 'http/cookie' # We only care about the first exception, not all of them Thread.report_on_exception = false 100.times.map do Thread.new do HTTP::CookieJar::HashStore.new end end.each(&:join) The above will reliably trigger an exception on all versions of TruffleRuby and many versions of JRuby. For example: $ ruby -v truffleruby 22.3.1, like ruby 3.0.3, GraalVM CE Native [x86_64-linux] $ ruby repro.rb /home/cbrasic/repos/http-cookie/lib/http/cookie_jar/abstract_store.rb:50:in `initialize': undefined method `each_pair' for nil:NilClass (NoMethodError) from repro.rb:10:in `block (2 levels) in <main>' $ jruby --version jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f OpenJDK 64-Bit Server VM 25.372-b07 on 1.8.0_372-b07 +jit [linux-x86_64] $ jruby repro.rb NameError: can't resolve constant HashStore after loading http/cookie_jar/hash_store const_missing at /home/cbrasic/.asdf/installs/ruby/jruby-9.1.2.0/lib/ruby/gems/shared/gems/http-cookie-1.0.5/lib/http/cookie_jar.rb:25 block in repro.rb at repro.rb:10
Configuration menu - View commit details
-
Copy full SHA for 48ce295 - Browse repository at this point
Copy the full SHA 48ce295View commit details
Commits on Jun 29, 2023
-
Add jruby runtime exclusion to abstract store
gemspec excludes sqlite3 from installing under jruby, so the mozilla_store.rb file will raise LoadError under JRuby. To avoid an undefined constant under jruby define a fake one that just raises.
Configuration menu - View commit details
-
Copy full SHA for 20d9927 - Browse repository at this point
Copy the full SHA 20d9927View commit details
Commits on Jun 30, 2023
-
<internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85: warning: <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85: warning: loading in progress, circular require considered harmful - /home/cbrasic/repos/http-cookie/lib/http/cookie_jar.rb from /home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>' from /home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select' from /home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from /home/cbrasic/repos/http-cookie/test/test_http_cookie.rb:2:in `<top (required)>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from /home/cbrasic/repos/http-cookie/test/helper.rb:4:in `<top (required)>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from /home/cbrasic/repos/http-cookie/lib/http/cookie.rb:7:in `<top (required)>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from /home/cbrasic/repos/http-cookie/lib/http/cookie_jar.rb:325:in `<top (required)>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from /home/cbrasic/repos/http-cookie/lib/http/cookie_jar/abstract_store.rb:115:in `<top (required)>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from /home/cbrasic/repos/http-cookie/lib/http/cookie_jar/hash_store.rb:2:in `<top (required)>' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/cbrasic/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require'
Configuration menu - View commit details
-
Copy full SHA for 401a002 - Browse repository at this point
Copy the full SHA 401a002View commit details
Commits on Jul 3, 2023
-
Ensure YAML/Psych/SQLite3 are not loaded unless they are used
Per request here: sparklemotion#43 (review)
Configuration menu - View commit details
-
Copy full SHA for e8dcdb4 - Browse repository at this point
Copy the full SHA e8dcdb4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a71a8b - Browse repository at this point
Copy the full SHA 5a71a8bView commit details